19

I want to disable tcp-offloading (TOE) on my Debian servers. I would use something like:

ethtool -K …

I have some wishes, though: is it possible to integrate it cleanly into Debian?

This reads: no rc.local, I would also like to avoid pseudo-rc-scripting.

I would guess, it's installing ethtool and using the pre-up.d/hook which deconfigures TOE using options from /etc/network/interfaces.

I would like to deconfigure all my (future) servers in a generic fashion using FAI (since FAI is already in place - and wanted!).

What about toe-options that are not supported on some hardware? Will networking fail if a non-existing-option should be disabled? I guess it should be robust not to do so, but this does not seem to be my wanted solution, either.

It clutters the config very much, since atm there are 11 options! Using multiple NICs this smells error-prone to me.

Isn't there a more generic solution? I have a sysctl in mind, but did not find one yet. My wish was:

echo 0 > /proc/sys/net/core/enable_tcp_offloading

PS: I'm quite surprised to find my "newer hardware" to have TOE enabled by default, because of this.

Eddie C.
  • 549
  • 1
  • 3
  • 12
Michuelnik
  • 3,558

4 Answers4

24

On Debian, the ethtool package now provides an if-up.d script that implements options for offloading (and other ethtool settings).

You just have to install this package and add lines like these to the interface in/etc/network/interfaces.

auto eth0
iface eth0 inet static
    address 10.0.3.1/255.255.248.0
    gateway 10.0.2.10
    offload-tx  off
    offload-sg  off
    offload-tso off
Eddie C.
  • 549
  • 1
  • 3
  • 12
hmlth
  • 256
8

Eureka! Found "my" solution!

I'm simply placing my own disable-toe Script in /etc/network/if-up.d/ which disables tcp-offloading completely.

As bonus I've added an /etc/network/interfaces-Option, that disables this.

#!/bin/bash

RUN=true
case "${IF_NO_TOE,,}" in
    no|off|false|disable|disabled)
        RUN=false
    ;;
esac

if [ "$MODE" = start -a "$RUN" = true ]; then
  TOE_OPTIONS="rx tx sg tso ufo gso gro lro rxvlan txvlan rxhash"
  for TOE_OPTION in $TOE_OPTIONS; do
    /sbin/ethtool --offload "$IFACE" "$TOE_OPTION" off &>/dev/null || true
  done
fi
Michuelnik
  • 3,558
3

If you're using a system that uses Netplan (e.g. Ubuntu) to configure the network then you can use a Netplan post-up script to configure offloading. As mentioned in an answer to another question.

You create a script in the following directory with a name prefixed by a number to indicate load order e.g. /etc/networkd-dispatcher/routable.d/40-offloading-config - which is executable and owned by root. e.g. To switch off TCP Segment Offloading on eth0:

#!/bin/sh
/sbin/ethtool -K eth0 tso off
Eddie C.
  • 549
  • 1
  • 3
  • 12
Pierz
  • 743
3

Off topic (sort of) but I ended up here when trying to figure out how to do the same thing for some RHEL6 servers. So if anyone is looking for the same thing for RHEL/CentOS/Fedora like distributions, you'll find the answer here.

PaddyD
  • 181