In a previous post I discussed how to set your NIC to 100Mbs Full duplex using ethtool. The downside with that is once you reboot the setting will be lost, so here is a simple script to make it permenant.
Note this is for Debian or Ubuntu.
Create a new script as follows:
$ sudo nano /etc/init.d/100Mbs
Add the following lines to the new file:
#!/bin/sh
ETHTOOL="/usr/sbin/ethtool"
DEV="eth0"
SPEED="100 duplex full"
case "$1" in
start)
echo -n "Setting eth0 speed 100 duplex full...";
$ETHTOOL -s $DEV speed $SPEED;
echo " done.";;
stop)
;;
esac
exit 0
Save and close the file.
To make the file executable change the permission with:
$ sudo chmod +x /etc/init.d/100Mbs
Now, to make the script run when the system boots up. Use update-rc.d command install System-V style init script links:
# sudo update-rc.d 100Mbs defaults
You shoild see an output like this :
Adding system startup for /etc/init.d/100Mbs ... /etc/rc0.d/K20100Mbs -> ../init.d/100Mbs /etc/rc1.d/K20100Mbs -> ../init.d/100Mbs /etc/rc6.d/K20100Mbs -> ../init.d/100Mbs /etc/rc2.d/S20100Mbs -> ../init.d/100Mbs /etc/rc3.d/S20100Mbs -> ../init.d/100Mbs /etc/rc4.d/S20100Mbs -> ../init.d/100Mbs /etc/rc5.d/S20100Mbs -> ../init.d/100Mbs
Either reboot the system or restart to process to take effect with:
$ sudo /etc/init.d/100Mbs start
Check your interface settings with ethtool
ethtool eth0
All done, you will never have to set your interface speed and duplex again
Subscribe to RSS


