|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
Softpanorama Search
|
| News | See Also | Recommended Links | Reference | Humor | Etc |
ethtool works with almost all NICs and permit checking and setting NIC speed as well as to force a multiple-speed NIC (such as 10/100Mbps, 100/1000Mbps, or 10/100/1000Mbps NIC) to one fixed and non-negotiable speed. Some network applications, such as ftp, might fails to work properly if NIC auto-negotiate speed with switch/router. Try the following command on your machine to see the output.
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: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: d
Link detected: yes
ns2:/home/bezroun # ethtool eth1
Settings for eth1:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
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
Link detected: yes
Here full duplex, half duplex and auto-negotiation have the following meanings.Note: If you want to find what type of network card is used, its
speed, on which IRQ it is listed, and the chip type used, you use the following
command : # dmesg |grep eth0
To set specific parameters usually option -s is used:
Red Hat directory/file: /etc/sysconfig/network-scripts/ifcfg-eth0:
Suse directory/file: /etc/sysconfig/network (suse defines interfaces via MAC)
For logging on to the net or for attaching as a node on a LAN, your computer needs a network card. The network card forms the interface between your computer and the network. There are different kinds of network cards available in the market depending on its speed and other features. Here is a tip to find out the characteristics of your network card.
If you want to find what type of network card is used, its speed, on which IRQ it is listed, and the chip type used, you use the following command :
Here eth0 is the first network card. If you have additional cards, it will be named eth1, eth2 and so on. And here is the output of the above command :# dmesg |grep eth0
The important things to note here are those highlighted in colour. As you can see from the above listing, my ethernet card is a RealTek RTL8139 chipset based card on IRQ 9 (Interrupt Request). Its speed is 100 Mbps and is a full-duplex card. And the link is up.divert: allocating divert_blk for eth0 eth0: RealTek RTL8139 at 0xd800, 00:80:48:34:c2:84, IRQ 9 eth0: Identified 8139 chip type 'RTL-8100B/8139D' divert: freeing divert_blk for eth0 divert: allocating divert_blk for eth0 eth0: RealTek RTL8139 at 0xd800, 00:90:44:34:a5:33, IRQ 9 eth0: Identified 8139 chip type 'RTL-8100B/8139D' eth0: link up, 100Mbps, full-duplex, lpa 0x41E1 eth0: no IPv6 routers present ...
As is the philosophy of Linux, there is more than one way of finding the same information. Linux also comes with a cute sounding tool called mii-tool which can also be used to get the same information about your network card.
# mii-tool -v eth0Here -v is verbose mode. From the above listed output, one can see that the ethernet card is working as a 100baseTX, FD (Full Duplex) card which can work in the following modes :eth0: negotiated 100baseTx-FD, link ok product info: vendor 00:00:00, model 0 rev 0 basic mode: autonegotiation enabled basic status: autonegotiation complete, link ok capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD ...
And it uses autonegotiation to bring up the link. You can call the above device as a 10/100 NIC.
- 100 Mbps Speed (Full duplex or half duplex ) or
- 10 Mbps speed (Full duplex or half duplex).
Another tool which also does the same thing is ethtool. Try the following command on your machine to see the output.
Here full duplex, half duplex and auto-negotiation have the following meanings.# ethtool eth0 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: p Current message level: 0x00000007 (7) Link detected: yes
Full Duplex - Logic that enables concurrent sending and receiving. This is usually desirable and enabled when your computer is connected to a switch.
Half Duplex - This logic requires a card to only send or receive at a single point of time. When your machine is connected to a Hub, it auto-negotiates itself and uses half duplex to avoid collisions.
Auto-negotiation - This is the process of deciding whether to work in full duplex mode or half duplex mode. An ethernet card supporting autonegotiation will decide for itself which mode is the optimal one depending on the network it is attached to.
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
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
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-HDSetup eth0 negotiated speed with ethtool
# mii-tool -F 10baseT-HD#
ethtool -s eth0 speed 100 duplex fullTo 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.
# ethtool -s eth0 speed 10 duplex half
Read man page of mii-tool and ethtool for more information.
Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
Disclaimer:
Created May 16, 1996; Last modified: August 12, 2009