Skip to content

Instantly share code, notes, and snippets.

@ElliotNB
Created November 29, 2018 22:28
Show Gist options
  • Save ElliotNB/9df95749eafd0982e3386d1dd2200394 to your computer and use it in GitHub Desktop.
Save ElliotNB/9df95749eafd0982e3386d1dd2200394 to your computer and use it in GitHub Desktop.
Disable all forms of offloading for all network interfaces on the local machine.
#!/bin/bash
##
## Disable all NIC offloading
## 2018-11-29 10:16 ElliotNB - bug fixes for non-interactive sessions and `sudo su` commands
## Licensed under MIT
##
## This script will disable all forms of offloading on all network interfaces found on
## this machine. This script was built to resolve system crashes related to the Xen kernel
## and certain hardware.
##
## Tested on RHEL6 and RHEL7.
##
## Usage:
##
## sudo sh disableNicOffloading.sh
##
for iface in $(ifconfig | cut -d ' ' -f1| tr ':' '\n' | awk NF)
do
## printf "$iface\n"
ethtool -K $iface tso off
ethtool -K $iface gso off
ethtool -K $iface gro off
ethtool -K $iface ufo off
ethtool -K $iface sg off
ethtool -K $iface highdma off
ethtool --offload $iface rx off tx off
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment