Software & AppsOperating SystemLinux

How To Disable TSO Offloading with Netplan on Ubuntu 18.04

Ubuntu 10

In this article, we will discuss how to disable TCP Segmentation Offload (TSO) with Netplan on Ubuntu 18.04. TSO is a technique used to increase outbound throughput of high-bandwidth network connections by reducing CPU overhead. However, in some cases, you might want to disable it for debugging or performance tuning.

Quick Answer

To disable TSO offloading with Netplan on Ubuntu 18.04, you can use the networkd-dispatcher package to create a script that will be executed when the network interfaces are brought up. In the script, you can use the ethtool command to disable TSO offloading on the specified network interface. Restart the network services for the changes to take effect.

Prerequisites

Before we begin, ensure that you have administrative access to your Ubuntu 18.04 system. You should also have a basic understanding of networking and Linux command line.

Understanding TSO

TCP Segmentation Offload is a technique used by network interface cards (NICs) to offload the segmentation of large TCP packets onto the hardware. This reduces the load on the CPU and can improve network performance. However, in some cases, TSO can cause performance issues or bugs, and you may need to disable it.

Installing networkd-dispatcher

To disable TSO offloading, we will use the networkd-dispatcher package. This package provides a daemon that can execute scripts when network interfaces go up or down.

To install networkd-dispatcher, use the following command:

sudo apt-get install networkd-dispatcher

Creating the Script

Next, we will create a script that will be executed when the network interfaces are brought up. This script will disable TSO offloading on the specified network interface.

Create a file in the /etc/networkd-dispatcher/routable.d/ directory. We will name our file 50-ifup-hooks:

sudo nano /etc/networkd-dispatcher/routable.d/50-ifup-hooks

In this script, add the necessary commands to disable TSO offloading. For example, to disable TSO offloading on the eno1 interface, you can use the following script:

#!/bin/sh

/sbin/ethtool -K eno1 tso off

Here, -K is used to change the offload parameters of the network device. eno1 is the name of the network interface, and tso off disables TSO offloading.

Making the Script Executable

After creating the script, save it and make it executable using the following command:

sudo chmod +x /etc/networkd-dispatcher/routable.d/50-ifup-hooks

Also, ensure that the script is owned by root:

sudo chown root:root /etc/networkd-dispatcher/routable.d/50-ifup-hooks

Restarting the Network Services

Finally, restart the network services for the changes to take effect:

sudo systemctl restart systemd-networkd.service
sudo systemctl restart networkd-dispatcher.service

Conclusion

Now, whenever the network interfaces are brought up, the 50-ifup-hooks script will be executed, and the TSO offloading on the eno1 interface will be disabled. This method provides a reliable way to execute post-up scripts with Netplan on Ubuntu 18.04.

Remember to replace eno1 with the name of your network interface, and ensure that the script is executable and owned by root for it to be executed properly.

By understanding and using these techniques, you can effectively manage and optimize your network performance on Ubuntu 18.04.

What is Netplan?

Netplan is a utility for managing and configuring network settings on Ubuntu systems. It allows users to easily configure network interfaces and apply changes without the need to manually edit configuration files.

How does TCP Segmentation Offload (TSO) affect network performance?

TCP Segmentation Offload (TSO) can improve network performance by offloading the task of segmenting large TCP packets onto the hardware, reducing CPU overhead. However, in some cases, TSO can cause performance issues or bugs, and disabling it may be necessary for troubleshooting or performance tuning.

Why would I want to disable TSO offloading?

There are several reasons why you might want to disable TSO offloading. It could be for debugging purposes, troubleshooting network performance issues, or addressing compatibility issues with certain network devices or software.

How can I determine if TSO offloading is enabled on my network interface?

You can use the ethtool command to check the offload parameters of your network interface. Running ethtool -k <interface> will display the current offload settings, including the status of TSO offloading.

Can I disable TSO offloading on multiple network interfaces?

Yes, you can disable TSO offloading on multiple network interfaces by creating separate scripts for each interface in the /etc/networkd-dispatcher/routable.d/ directory. Just make sure to name the scripts accordingly (e.g., 50-ifup-hooks-<interface>), and include the appropriate ethtool command to disable TSO offloading for each interface.

Will disabling TSO offloading have any negative impact on network performance?

Disabling TSO offloading may result in a slight increase in CPU utilization, as the segmentation of large TCP packets will be handled by the CPU instead of the hardware. However, the impact on overall network performance will depend on various factors such as the network workload and hardware capabilities. It is recommended to monitor the performance after disabling TSO offloading to assess any noticeable differences.

Leave a Comment

Your email address will not be published. Required fields are marked *