I would like to turn off tcp segmentation offload on a CentOS5 server. Using ethtool the command is
ethtool -K eth0 tso off However, this setting only persists for this session. How can I make it persist through reboots?
From this webpage:
You can enter the ethtool commands in
The network service in CentOS has the ability to do this. The script
We can create this file with touch
A simple script to apply the same settings to all interfaces would be something like
Keep in mind this will attempt to apply settings to ALL interfaces, even the loopback.
If we have different interfaces we want to apply different settings to, or want to skip the loopback, we can make a case statement
Now ethtool settings are applied to interfaces as they start, all potential interruptions to network communication are done as the interface is brought up, and your server can continue to boot with full network capabilities.
Yeah, it can't be done using configuration files for the moment. You can put up the command in
That file is executed at the last of the booting sequence and so tso would be turned off for the interface.
Off-topic, for Ubuntu users who came here, like me, this as a note:
On Ubuntu, the textbook way to do it is to edit the /etc/network/interfaces file which in turn is read by the init.d/pre-up -up, etc. scripts. So an /etc/network/interfaces file might look like this:
That's what the docs say, but it does not work. Might be that the parsing logic in the pre-up and up scripts is a bit dated and they don't parse out the required settings from the interfaces file. Don't know. At least, it was not working for me.
So the hack-ish but working solution for now is still to create/edit a local /etc/rc.local file and stating the command to be exuted there (but note that this may interrupt networking for a seconds after the interface has already been brought up). So having this:
in /etc/rc.local is the working solution to slow down an interface as intended above.
I ran into problems with the accepted answer (which, I hasten to add, I found very helpful) because I was using bonded interfaces.
It took me a while to discover what was happening but I found that when bringing up a bond, or even when bringing up a bond slave individually, the
To get round this I modified my
In the end my
Caveat: the contents of /proc/net/bonding/bondX may be different for different versions of RedHat/Fedora/CentOS to the one I was using when I wrote the script, so the command to pull out the slave interface names may not work.