Skip to content

Instantly share code, notes, and snippets.

@akhepcat
Created July 20, 2022 21:57
Show Gist options
  • Save akhepcat/8d6c5bafb832ee2df036bc5746b412d1 to your computer and use it in GitHub Desktop.
Save akhepcat/8d6c5bafb832ee2df036bc5746b412d1 to your computer and use it in GitHub Desktop.
quick network interface renegotiation script and helper
# Install in /etc/systemd/system
# enable as '[email protected]' or other interface(s)
#
[Unit]
Description=ethtool configuration to enable 2500mbps speed for the specified card
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/local/sbin/renegotiate-eth %i
Type=oneshot
[Install]
WantedBy=multi-user.target
#!/bin/bash
# put this in /usr/local/sbin
# make sure ethtool is installed and in the basic path
if [ -n "$1" ]
then
ethtool -s "$1" autoneg off
ethtool -s "$1" autoneg on
# ethtool --negotiate "$1"
ethtool "$1" | grep Speed
else
echo "which interface?"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment