Permanently change Duplex settings and Network card speed in Ubuntu

Users of Alliance or similar broadband services might have noticed that their network connection would sometimes get dropped while on Ubuntu or the network speed is somewhat less than what is advertised. The solution for this is that you need to change the duplex setting of your network connection. Don’t freak out yet, it’s not as hard as you might think. Follow the below simple steps:

1. Get the desired duplex settings from your service provider. In this case, we will assume that it’s “10 duplex half”. Replace it with the appropriate speed in your case.

2. Open Ubuntu Software Center, search for the following package and install. 

ethtool

3. Open Gedit or any other Text editor and paste the following:

#!/bin/sh
ETHTOOL=’/sbin/ethtool’
DEV=’eth0′
SPEED=’10 duplex half’
case $1 in
start)
echo -n “Setting eth1 speed 10 duplex half…”;
$ETHTOOL -s $DEV autoneg off speed $SPEED;
echo ” done.”;;
stop)
;;
esac
exit 0

4. Check the following:

  • Open Terminal. Paste “which ethtool” without the quotes and Enter. If it is not “/sbin/ethtool”, copy the result and replace it with “/sbin/ethtool” in the second line of the Text editor.
  • Go to the network applet (top right corner region of the screen) and click on Connection Information (assuming you are connected to the network for which you are going to change the duplex setting. If you are not, go to Network Connections -> Edit the connection -> Ethernet tab, notice the name inside braces after Device Mac Address). Check for the line “Interface : Ethernet(eth0)”. If it is not ‘eth0’ in your case, copy it (‘ethX’) and paste it in place of ‘eth0’ in the third line of the Text editor.
  • Replace ’10 duplex half’ with the appropriate speed for your case in the fourth line of the Text editor.

5. Save the untitled document in your home directory with any name. Lets say, we saved it with the name 10Mbps.sh (in the subsequent steps, if your file name is different, don’t forget to replace ’10Mbps.sh’ with your file name wherever applicable).

6. Open Terminal and paste the following one by one (if you are not using Ubuntu, then change ‘nautilus’ with your installed file manager in the below line) :

sudo nautilus /etc/init.d/

7. Copy the file (10Mbps.sh) to the newly opened window. Right click on the file, click on Properties, go to the Permission tab, check the Execute check-box and close it.

We are almost done now. In the next step, we check if everything we did is correct.

8. Go the Terminal again and paste the following (one by one) :

sudo /etc/init.d/10Mbps.sh start

sudo ethtool eth0

Change ‘eth0’ if it’s different in your case (step 4). After executing the above commands, look for these lines in the result:

Speed: 10Mb/s
Duplex: Half

If it matches with your input, then we are good to go. If you encounter any error at this stage, don’t proceed before resolving those.

9. Phew! We are at the final step of this long tutorial at last! Paste the below command in Terminal:

sudo update-rc.d 10Mbps.sh defaults

Again, don’t forget to replace file name ’10Mbps.sh’ if it’s different in your case.

We are done now. Restart your computer for the changes to take effect. Although this tutorial assumes that you are using Ubuntu, it should work on any Ubuntu or Debian based distro with little or no modification. Let me know in the comments section if you face any issue.

Advertisements

I am a software developer and an open-source enthusiast. I am also a hobbyist blogger in my leisure time.

Tagged with: , , , , ,
Posted in HowTos, Ubuntu

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: