Under Debian or Ubuntu Linux just create a script as follows:
# nano /etc/init.d/100Mbs
OR
$ sudo nano /etc/init.d/100Mbs
Append following lines:
#!/bin/sh
ETHTOOL="/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. Setup executable permission:
# chmod +x /etc/init.d/100Mbs
OR
$ sudo chmod +x /etc/init.d/100Mbs
Now run script when Debian or Ubuntu Linux boots up. Use update-rc.d command install System-V style init script links:
# update-rc.d 100Mbs defaults
OR
# sudo update-rc.d 100Mbs defaults
Output:
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
Reboot the system to take effect or just type scrit name:
# /etc/init.d/100Mbs start
OR
$ sudo /etc/init.d/100Mbs start
source:http://www.cyberciti.biz/tips/howto-linux-add-ethtool-duplex-settings-permanent.html
No comments:
Post a Comment