Created
August 8, 2016 11:18
-
-
Save greyltc/e8dbaeb4c1f7ec806a7b754601ec7a4d to your computer and use it in GitHub Desktop.
bash script to change interface to 100baseTx given its mac address
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eu -o pipefail | |
# this is the mac address of the interface we're interested in | |
MAC_OI="20:47:47:f8:f4:71" | |
for i in /sys/class/net/* ; do | |
I_MAC=$(cat $i/address) | |
INTERFACE=$(basename $i/) | |
if [ "$MAC_OI" = "$I_MAC" ]; then | |
ETH_INTERFACE=$INTERFACE | |
fi | |
done | |
mii-tool -F 100baseTx-FD ${ETH_INTERFACE} | |
ethtool -s ${ETH_INTERFACE} speed 100 duplex full |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment