How to write a NetworkManager dispatcher script to apply commands on interface start?

https://access.redhat.com/solutions/2841131

Solution Verified - Updated June 14 2024 at 7:23 PM - English Environment Red Hat Enterprise Linux 9 Red Hat Enterprise Linux 8 Red Hat Enterprise Linux 7 NetworkManager used to manage network connections Network interface supporting configurable offload via ethtool -K commands Issue How to write a NetworkManager dispatcher script to apply ethtool commands? Need to apply ethtool offloading to a network interface at boot or startup? What is the correct syntax for a NM dispatcher script to enable or disable offloading like checksumming or large receive (GSO/LRO) or segmentation (GRO/LSO)? Resolution Some versions of NetworkManager have support for ethtool parameters. Please see solution https://access.redhat.com/solutions/2127401 for details. Red Hat recommend using native support if possible. Otherwise create a unique executable file in the /etc/NetworkManager/dispatcher.d/ directory, for example: Raw touch /etc/NetworkManager/dispatcher.d/30-ethtool chmod +x /etc/NetworkManager/dispatcher.d/30-ethtool For a standalone network interface:

Raw #!/bin/bash

if [ “$1” == “eth0” ] && [ “$2” == “up” ]; then ethtool -K “$1” rx off gro off lro off fi For 2 standalone network interfaces:

Raw #!/bin/bash

if [ “$1” == “eth0” -a “$2” == “up” ] || [ “$1” == “eth1” -a “$2” == “up” ] ; then ethtool -K “$1” rx off gro off lro off fi For a bonding or teaming network interface:

Raw #!/bin/bash

if [ “$1” == “bond0” ] && [ “$2” == “up” ]; then for INTERFACE in bond0 eth0 eth1; do ethtool -K “$INTERFACE” rx off gro off lro off done fi Modify the list of interfaces as required, ensure the parent bond/team device and all slave devices have settings applied to them. Note that some interface types are not compatible with all ethtool options.

Root Cause Dispatcher scripts are explained in man NetworkManager, including the parameters passed to the dispatcher script.

Usually this sort of offloading only needs to be applied at interface start, so match the device name as the first script parameter, and the up action as the second script parameter.

The dispatcher script can be any language and perform any command, they are not restricted to bash or to ethtool commands.

Product(s) Red Hat Enterprise LinuxComponent ethtool NetworkManagerTags configuration hardware network networking NetworkManager network_stack scripting scripts This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Was this helpful?

People who viewed this solution also viewed When NetworkManager dispatcher scripts run? Solution - 15 Jun 2024 Migrating custom network scripts to NetworkManager dispatcher scripts Solution - 14 Jun 2024 How to create NetworkManager dispatcher script to remove local route? Solution - 19 Jun 2025 Get notified when this content is updated Comments Newbie Add your comment: Add comment Send notifications to content followers Submit Active Contrib… 111 points Mar 7, 2019 1:00 AM Steven says: Will be trying this out later today. I am hopeful.

Reply Community Member 37 points Jun 24, 2019 10:20 AM Steven Olson says: It didn’t work for me

Updated: