Friday, July 20, 2007

changing ethernet card settings howto

Here's some scenario wherein your network card seems to fail. At times, it shows you statistics of sending but not receiving packets, or it is physically connected but show you that the linkis not present at all. If you are sure that it is not driver or cable issues related, below are pointers of changing network card settings.

We are going to make use of this linux command ethtool instead of miitool .

Let us say we have a single active NIC card which is properly installed and named eth0. To display your eth0 current settings:

# 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: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: g
Current message level: 0x00000007 (7)
Link detected: yes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Since mine is working fine, I should get "Link detected: yes" from the last resulting output above. Here you can see that my speed is set to 100Mb/s and I have Full Duplex and Wake-on-Lan set.

Let us change our NIC eth0 speed

# ethtool -s eth0 speed 10

You'll see changed values from looking at its current state by doing

# ethtool eth0

again. Similar lines like:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Speed: 10Mb/s
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Disabling NIC's autonegogation feature would be like

# ethtool -s eth0 autoneg off

giving you similar lines like
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Auto-negotiation: off
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Changing NIC's duplex type

# ethtool -s eth0 duplex half
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Duplex: Half
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Now, let us try to disable wake on lan feaure with our eth0 and make it wake on nothing value.

# ethtool -s eth0 wol d

You can alternatively combine these arguments like so:

# ethtool -s eth0 speed 10 duplex half autoneg off

which does the same job. See below:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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: d
Current message level: 0x00000007 (7)
Link detected: yes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


ethtool is available over the web on here .

TIP:

Get your NIC make or model type

# lspci | grep Ethernet

and make sure the net modules is loaded right

# cat /etc/modprobe.conf | grep eth


Now, if you've messed up with your eth0 settings, you can put them back by

# ifdown eth0
# ifup eth0

HTH

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy