Sunday, March 27, 2011

How to change network card speed and duplex settings in ubuntu

If you want to change speed and duplex of your network card you have to use ethtool or mii-tool.
ethtool can be used to query and change settings such as speed, auto- negotiation and checksum offload on many network devices, especially Ethernet devices.

In ubuntu if you want to use mii-tool you have to install net-tools package.
Net-tools package includes the important tools for controlling the network subsystem of the Linux kernel. This includes arp, ifconfig, netstat, rarp, nameif and route. Additionally, this package contains utilities relating to particular network hardware types (plipconfig, slattach, mii-tool) and advanced aspects of IP configuration (iptunnel, ipmaddr).
In the upstream package ‘hostname’ and friends are included. Those are not installed by this package, since there is a special “hostname*.deb”.
Install required packages
sudo apt-get install ethtool net-tools
First you need to find the existing network card speed for this you can use the following command
ethtool eth0
Once you have the current speed and duplex details you can change using the following commands
If you want to setup eth0 10 or 100 or 1000 speed with ethtool try this
sudo ethtool -s eth0 autoneg off speed 10 duplex half
sudo ethtool -s eth0 autoneg off speed 100 duplex full
sudo ethtool -s eth0 autoneg off speed 1000 duplex full
If you want to make it permanent you have to add following lines to /etc/network/interfaces file
gksudo gedit /etc/network/interfaces
Add the following line
pre-up /usr/sbin/ethtool -s $IFACE autoneg off 100 duplex full
Save and exit the file
You need to restart networking services using the following command
sudo networking restart

No comments:

Post a Comment