Home > Network > Viewing and changing netword card setting

Viewing and changing netword card setting

Print Friendly, PDF & Email

Checking our network card current setting

There are two commands that we can use to check our current network card setting. The first command is “mii-tool”, it  has been around almost since the beginning of Linux and will be depreciated in the future version of Linux. If we don’t specify any parameter to the “mii-tool” command, we will get one line of information per network card. It will display the current speed of the network card, the duplex mode it’s using and if you have a link or not.  If we don’t have a link up (no link) and it is suppose to be, I suggest to verify that your cable is connected to the server and that the port on the network switch is activate.  If this is the case, you may want to try another network cable and see if the link come up.

# mii-tool
eth0: 100 Mbit, full duplex, link ok
eth1: 100 Mbit, full duplex, no link
#

If we add the verbose parameter (-v), we will get some additional information about each network card.

# mii-tool -v
eth0: 100 Mbit, full duplex, link ok
 product info: vendor 00:aa:00, model 50 rev 0
 basic mode:   100 Mbit, full duplex
 basic status: link ok
 capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
 advertising:  100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
eth1: 100 Mbit, full duplex, no link
 product info: vendor 00:10:18, model 23 rev 6
 basic mode:   100 Mbit, full duplex
 basic status: no link
 capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
 advertising:  100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
#

I would suggest using the “ethtool” command instead of the depreciated “mii-tool”. The “mii-tool” may not work with some of the newer network card and  may be excluded from future version of RedHat/Centos/Fedora. With the “ethtool” command,  we need to specify the name of the interface that we want to see the current state. In all of our example, we will use the interface “eth0”.

# 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: No
 Speed: 100Mb/s
 Duplex: Full
 Port: MII
 PHYAD: 1
 Transceiver: internal
 Auto-negotiation: off
 Supports Wake-on: g
 Wake-on: g
 Current message level: 0x00000007 (7)
 Link detected: yes
#

Display driver information

If we want to see some driver information about our network card, use the “-i” parameter next to the “ethtool” command.

In this example, we can see that the driver we are using for this card is “e100″.  Effectively, if we use the “lsmod” (list module) we found out the the “e100″ is actually loaded.

# ethtool -i eth0
driver: e100
version: 3.5.10-k2-NAPI
firmware-version: N/A
bus-info: 0000:05:08.0
#
# lsmod | grep e100
e100                   36809  0
mii                     9409  2 3c59x,e100
#

Display statistics information

With the “-S” parameter,  we can display statistics about our network card.

This information could be valuable if you are experimenting some problem with that interface. It will confirm your doubt or it will indicate that you should check somewhere else to identify the problem.

# ethtool -S eth0
NIC statistics:
 rx_packets: 12684
 tx_packets: 7638
 rx_bytes: 14990414
 tx_bytes: 621100
 rx_errors: 8
 tx_errors: 0
 rx_dropped: 0
 tx_dropped: 0
 multicast: 0
 collisions: 0
 rx_length_errors: 7
 rx_over_errors: 0
 rx_crc_errors: 1
 rx_frame_errors: 0
 rx_fifo_errors: 0
 rx_missed_errors: 0
 tx_aborted_errors: 0
 tx_carrier_errors: 0
 tx_fifo_errors: 0
 tx_heartbeat_errors: 0
 tx_window_errors: 0
 tx_deferred: 0
 tx_single_collisions: 0
 tx_multi_collisions: 0
 tx_flow_control_pause: 0
 rx_flow_control_pause: 0
 rx_flow_control_unsupported: 0
 tx_tco_packets: 0
 rx_tco_packets: 0
#

Network adapter self test

You can also run a self test on the network card.  Beside the interface name you can specify two types of tests:  offline (default) means to perform full set of tests possibly causing normal operation interruption during the tests, online means to perform limited set of tests do not interrupting normal adapter operation.

# ethtool -t eth0 online
The test result is PASS
The test extra info:
Link test     (on/offline)       0
Eeprom test   (on/offline)       0
Self test        (offline)       0
Mac loopback     (offline)       0
Phy loopback     (offline)       0

# ethtool -t eth0 offline
The test result is PASS
The test extra info:
Link test     (on/offline)       0
Eeprom test   (on/offline)       0
Self test        (offline)       0
Mac loopback     (offline)       0
Phy loopback     (offline)       0
#

Changing network card setting interactively

Below we change the network card setting from the command line. I strongly recommend doing these changes on the console,  if not you may loose your network connection with the your server.
In this example we will set the interface “eth0” speed to 10Mb/s and the duplex mode to half. After doing the change we use again the “ethtool” command to verify that our change have took place.

# ethtool -s eth0 speed 10 duplex half
# 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: No
Speed: 10Mb/s
Duplex: Half
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: g
Wake-on: g
Current message level: 0x00000007 (7)
Link detected: yes
#

We will now set back our network card speed back to 100Mb/s, the duplex mode to “Full” and activate the speed autonegociate.

Again we verify that our change have took place by issuing the “ethtool -s eth0” command.

# ethtool -s eth0 speed 100 duplex full autoneg on
# 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:  100baseT/Full
 Advertised auto-negotiation: Yes
 Speed: 100Mb/s
 Duplex: Full
 Port: MII
 PHYAD: 1
 Transceiver: internal
 Auto-negotiation: on
 Supports Wake-on: g
 Wake-on: g
 Current message level: 0x00000007 (7)
 Link detected: yes
#

Setting speed and duplex at boot time

If we want to set the network card setting permanently, so they are preserve even after rebooting the the server, we need to open the file:

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Append following line:

ETHTOOL_OPTS="speed 100 duplex full autoneg off"

If you want that change to become effective now, you will need to restart the network service. Be aware that people and/or processes running on the system may be affected by this restart.

# service network restart

Hoping this article will be prove to be useful and see you soon.

Categories: Network