Sep 14

How to make ethtool settings "stick" on Ubuntu

Category: Linux,Ubuntu   — Published by goeszen on September 14, 2012 at 11:56 pm

On one of my systems I had to set my network to a strange configuration to get reliable connections:

sudo ethtool -s eth0 autoneg on speed 10 duplex half

I did this via ethtool after login, but then, I wanted this setting to be the default, after boot, automatically - I wanted to make the network setting "stick". Normally, on Debian, you setup your interfaces in /etc/network/interfaces, but on this system, running Ubuntu, the eth0 interface was not in /etc/network/interface!

A quick stint to Google brought the answer: I have network-manager installed and then, there are no th0 entries in the file.

So, the only solution is to edit the rc scripts, although this is normally not the way to go, you would do:

iface eth0 inet static
  post-up /usr/sbin/ethtool -s eth0 ...
  post-down /usr/sbin/ethtool -s eth0 ...

So every runmode properly brings up /brings down the interface. But when running network-manager the only hackish solution is to add the command to /etc/rc.local

One Response to “How to make ethtool settings "stick" on Ubuntu”

  1. dragon788 says:

    You could also put a script into /etc/NetworkManager/dispatcher.d/ that runs this if the interface name ($1 to the script) is coming up ($2 to the script) and then run ethtool that way. I also don't think you need a post-down to change it unless you only run into the issue with a switch at home and one at work is fine at full speed.

Leave a Reply