Linux change the speed and duplex settings of an Ethernet card

by on May 2, 2006 · 32 comments· LAST UPDATED December 24, 2007

in , ,

Q. How do I change the speed, duplex on for my Ethernet card?

A. Under Linux use mii-tool or ethtool package which allows a Linux sys admin to modify/change and view the negotiated speed of network interface card (NIC) i.e. it is useful for forcing specific Ethernet speed and duplex settings.

Depending on which type of Ethernet card is installed on the system you need to use either mii-tool or ethtool. I recommend installing both and use one of the tool, which will work with your card.

Task: Install mii-tool and ethtool tools

If you are using Debian Linux you can install both of these package with following command:# apt-get install ethtool net-toolsIf you are using Red Hat Enterprise Linux you can install both of these package with following command:# up2date ethtool net-toolsIf you are using Fedora Core Linux you can install both of these package with following command:# yum install ethtool net-tools

Task: Get speed and other information for eth0

Type following command as root user:
# ethtool eth0Output:

Settings for eth0:
     Supported ports: [ TP MII ]
     Supported link modes:   10baseT/Half 10baseT/Full
                             100baseT/Half 100baseT/Full
     Supports auto-negotiation: Yes
     Advertised link modes:  10baseT/Half 10baseT/Full
                             100baseT/Half 100baseT/Full
     Advertised auto-negotiation: Yes
     Speed: 100Mb/s
     Duplex: Full
     Port: MII
     PHYAD: 32
     Transceiver: internal
     Auto-negotiation: on
     Supports Wake-on: pumbg
     Wake-on: d
     Current message level: 0x00000007 (7)
     Link detected: yes

Or use mii-tool command as follows:# mii-tool eth0Output:

eth0: negotiated 100baseTx-FD flow-control, link ok

Task: Change the speed and duplex settings

Setup eth0 negotiated speed with mii-tool
Disable autonegotiation, and force the MII to either 100baseTx-FD, 100baseTx-HD, 10baseT-FD, or 10baseT-HD:# mii-tool -F 100baseTx-HD
# mii-tool -F 10baseT-HD
Setup eth0 negotiated speed with ethtool# ethtool -s eth0 speed 100 duplex full
# ethtool -s eth0 speed 10 duplex half
To make these settings permanent you need to create a shell script and call from /etc/rc.local (Red Hat) or if you are using Debian create a script into the directory /etc/init.d/ directory and run update-rc.d command to update the script.

Read man page of mii-tool and ethtool for more information.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 32 comments… read them below or add one }

1 Kelly November 15, 2006 at 6:59 pm

I get an “SIOCSMIIREG on eth2 failed: Invalid argument” error when entering “mii-tool -F 100baseTx-FD eth2″ What does this mean? Thanks.

Reply

2 nixCraft November 16, 2006 at 1:39 pm

Try to use ethtool. It appears that mii-tool is not compatible with your NIC.

Reply

3 dimko December 10, 2007 at 11:59 am

Thanks for info, very use full!

Reply

4 Alexey February 15, 2008 at 10:47 pm

I run “ethtool -s eth0 speed 10 duplex half” then run “ethtool eth0″ and get “Speed: 100Mb/s”.

So speed was not changed really.
Why?

Reply

5 Mage767 April 2, 2008 at 8:28 am

How to get wired LAN running at FULL-DUPLEX

At the Linux Terminal, type:

sudo ethtool eth0

This will tell you the properties of the wired config. If Duplex is showing half, then type:

sudo ethtool -s eth0 autoneg off
sudo ethtool -s eth0 duplex full

Finally, type to view final configuration:

sudo ethtool eth0

Reply

6 G SAI KRISHNA February 19, 2014 at 12:52 pm

thank you so much It worked wondefully superb way …..

Reply

7 LeMMiNGS June 23, 2008 at 9:17 am

Google & Vivek pwns!

Reply

8 Shawn July 15, 2008 at 10:01 pm

On Red Hat Enterprise, and SuSE Enterprise (and probably others) you can include the options in your interface config file using the ETHTOOL_OPTS argument:
# red hat: /etc/sysconfig/network-scripts/ifcfg-eth0
# sles: /etc/sysconfig/network/ifcfg-eth-id-{mac address}
ETHTOOL_OPTS=”autoneg off speed 100 duplex full”

Note that you cannot disable autonegotiation on gig-ethernet over copper. Autonegotiation is REQUIRED in the 802.3ab definition (http://standards.ieee.org/reading/ieee/interp/IEEE802.3af-2003interp-6.pdf)

Reply

9 fsaenz September 13, 2008 at 11:01 am

There is way to “fix” the speed on a gig-ethernet NIC while complying with the standard, based on the last paragraph of the article mentioned above by Shawn (http://standards.ieee.org/reading/ieee/interp/IEEE802.3af-2003interp-6.pdf):

# ethtool -s eth0 speed 1000 duplex full autoneg on

The NIC keeps the auto-negotiation but only advertises 1000mbps. It works fine.

Reply

10 westea December 26, 2008 at 11:55 pm

I have a Dell laptop (Precision M6300) with Broadcom NetXtreme ethernet controller and
a wireless Dell WLAN Mini card. I had Fedora installed and can dual boot Windows XP or Fedora. I decided to start with the Broadcom controller since many of the Web sites imply
that the wireless ethernet on linux can be frustrating. Unfortunately, the “wired” ethernet is
also proving to be a problem. I will try the tools you have listed and hope. Certainly the
Administor->network-> gui interface did not work. Tried the tg3 driver but when I activate
it, it says it is not there. Of course I am sending this email thru the BroadCom controller but
with the XP OS. There seems to be a big difference between a linus USER and Admin. Oh well
I will reboot and try some of your suggestions.

Reply

11 kanon January 5, 2009 at 8:48 pm

My 1gbit card refuses to report 1gbit. GRRRR! I use the ethtool, but at no vail. The mii-tool dont do to much for my Debian system either.
Might be a stupid question, but are there some config settings for the network file? Im sure I had it running at 1gbit, but I also remember it was a hassle to get it to run at that speed.
Well, off to google again.. :)

Reply

12 Christian Peper January 15, 2009 at 10:01 am

@kanon
1000Base-T requires the use of auto nego. So perhaps the switch you’re using doesn’t offer it and the NIC decides to fallback to 100Mb? Just an idea…
Chris

Reply

13 V.Balaviswanathan April 27, 2009 at 1:42 pm

Cool one……..Thanks for the post

Reply

14 Hector May 22, 2009 at 3:36 pm

Super now my Debian is work with my internet, I was change of 100TX to 10T , but Now I like to create one script that when restart my Debian is work my internet, the question is How I’ll create the Script? please any one there help me and send my same example or the solution.

Thanks for the post.

Reply

15 David Baron August 18, 2009 at 5:21 pm

Very useful article! Trying any of this leaves me with no link, no connection. I can run 10mb/s half duplex, autonegotiated. Attempts to force, no auto yield no link. No response to pon.

I am running Debian Sid, NIC ethO –>pptp pppO to ASDL modem.

Reply

16 Fabrizzio October 12, 2009 at 5:00 pm

Alexey, I had the same problem.
You need to turn off autoneg to use a sub-optimal speed.
ethtool -s eth0 autoneg off speed 10 duplex half

Reply

17 Philippe Petrinko January 6, 2010 at 2:33 pm

Hi Vivek,

As you pointed out, mii-tools may be deprecated, so
would you mind modifying accordingly your very interesting topic,
and consider adding what Mage767 has most conveniently added:
How to switch off auto-negocation using ethtool :
# ethtool -s eth0 autoneg off

So, to sum uop, either you are lucky enough to do both action alltogether:
# ethtool -s eth0 duplex full autoneg off
(this works for my Ethernet Card)

Either you need to do it in 2 steps:
# ethtool -s eth0 autoneg off
# ethtool -s eth0 duplex full

Thanks for your anwser – BTW you brought up a solution I had been wondering for months !
— Philippe

Reply

18 sree May 22, 2014 at 7:07 am

How to switch on autoneg on in linux ?
I tried below command for 10G intel nic card
# ethtool -s xaui0 duplex full autoneg on
it is showing follwing output
Cannot set new settings: Invalid argument
not setting duplex
not setting autoneg

Reply

19 Bob March 15, 2010 at 11:28 pm

This command does not seem to be working with Centos 4.5 Final

ethtool -s eth0 speed 100 duplex full

It locks up the NIC. I was able to SSH in from the secondary port and reboot the server gracefully.

Prior to changing the speed and duplex mode I get:

[root@hw000 vz-scripts]# ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Half
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: g
Current message level: 0x00000007 (7)
Link detected: yes

Then I enter and it hangs:

Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 100baseT/Full
Advertised auto-negotiation: Yes
Speed: Unknown! (65535)
Duplex: Unknown! (255)
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: g
Current message level: 0x00000007 (7)
Link detected: no

– Ethernet controller: Intel Corporation 82541GI Gigabit Ethernet Controller
– Ethernet controller: Intel Corporation 82547GI Gigabit Ethernet Controller

Reply

20 Joe Wulf May 24, 2010 at 6:52 pm

On RHEL ES4u6 32bit, when I execute “ethtool eth0″ it does NOT give me the speed, which I desire to know. I’ve played with the options, but don’t see anything obvious that forcefully provides information on the nic/link speed.

Any other option/method for determining, via the CLI the nic/link current speed?
Thanks

Message submitted 2010/05/24 @ 14:45 EST (as the article and messages don’t indicate their date of posting)

Reply

21 nixCraft May 24, 2010 at 7:23 pm

Try mii-tool.

And thanks for heads up. I’ve fixed the problem with date and time. Now comment displays the date properly for all posts.

Reply

22 Joe Wulf May 24, 2010 at 8:21 pm

Hmm, my previous attempt to say this seems to have gone off into the ether (but not eth). :)

Thank you, too—and your are welcome as well, Vivek Gite. I appreciate the quick response!
However, I’ve no joy with using the ‘mii-tool’ you’d suggested.

‘ethtool eth0′ returns only the following output:
“Settings for eth0:
Current message Level: 0x00000007 (7)
Link Detected: yes”
—-and nothing further.

‘dmesg | less’ and manually searching for eth0 returns only the following:
“divert: allocationg divert_blk for eth0
eth0: registered as PCnet/PCI II 79c970a
eth0: no IPV6 routers present”

‘mii-tool eth0′ returns only the following:
“SIOCGMIIPHV on ‘eth0′ failed: Operation not supported.”

I get this, primarily on VMs within an ESX 3.5.0 host.

R,
-Joe Wulf

Reply

23 Joe Wulf May 25, 2010 at 4:39 pm

So, other than eth-tool and mii-tool……….. are there any other *creative* ways to determine NIC speed, from within the system at the command line?

R,
-Joe

Reply

24 nixCraft May 25, 2010 at 7:31 pm

VMWarw is known to have a few issues with ethtool. Try
ethtool -i vmnic0
And esxcfg-nics command can also help.

HTH

Reply

25 sanjay July 6, 2010 at 6:41 am

i commends is very useful thankx to all.

Reply

26 Jadiyappa April 21, 2011 at 11:13 am

I changed the full duplex to half duplex using command
/sbin/ethtool -s eth0 speed 10 duplex half

but if do
/sbin/ethtool eth0 getting o/p: as below :
/sbin/ethtool eth0
Settings for eth0:
Supported ports: [ TP 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: Full
Port: MII
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000033 (51)
Link detected: yes
that indicates my PC is not getting changed to half duplex

Pls help me what i have to do?

Reply

27 daksh July 27, 2011 at 6:57 pm

yeah really it works…, thanks a lot.
Actually i was looking it from centos help sites, but i got only dust there,

now i tried it, And my net is working,
it is working of 10bastT-HD

Thanks for supporting code in this simple manner…

Reply

28 Jon January 27, 2012 at 9:04 pm

I have Red Hat RHEL 5.5 and when I use the ethool
# ethtool -s eth0 speed 1000 duplex full
I get the erro of :
Cannot set new settings: Invalid argument
not setting speed
not setting duplex
Is this a bug in RHEL 5.5? It worked in RHEL 4.8

Reply

29 Nehemoth April 2, 2013 at 2:02 am

In Debian (also Raspberry pi) this is the way to do it as per document
/usr/share/doc/ethtool/README.Debian

iface eth0 inet dhcp
link-speed 100
link-duplex full
ethernet-autoneg off

works like a charm

Reply

30 Vijay Kishore February 5, 2014 at 10:37 am

Hi,
I am using freescale processor MPC8548E based customized board .

Once the Linux is loaded on the target I gave the following ommand:
ifconfig media 100baseTX mediaopt full-duplex
as mentioned above.

But it is dispplaying the error:
ifconfig: bad address ‘media’…

I am trying to set the board eth1 port to work in 100 Mbps, Full Duplex mode.

ethtool and mii-tool are not working on the target. I am getting the error as: Command not found…..

Reply

31 Vijay Kishore February 5, 2014 at 10:39 am

ifconfig command is given as:
ifconfig media 100baseTX mediaopt full-duplex

Reply

32 bender October 29, 2014 at 6:26 pm

For me, it wasn’t auto negotiating to 1000 full duplex even though it had in the past.

I replaced the ethernet cable from an old cord to a brand new shielded one and it switched right into 1000 Mbps Full Duplex. (The computer is plugged into a gigabit switch, naturally.)

In my /etc/sysconfig/network-scripts/ifconfig-eno1 the ethtool line is as follows:
ETHTOOL_OPTS=”autoneg on”

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , ,

Previous Faq:

Next Faq: