#!/bin/sh # # Trivial script to change the MAC address # You can define some easy to remember aliases by editing the source # by Mario Vilas (mvilas@gmail.com) # # if run with no parameters use the default MAC="${1}" if [ -z "${MAC}" ] then MAC="default" fi # ensure that the script is run as root if [ `id -u` != 0 ] then if [ "${2}" = "" ] then sudo ${0} ${MAC} ALREADY_SUDOED exit else echo "ERROR: this script is intended to be run as root" exit 1 fi fi # some easy-to-remember aliases case "${MAC}" in default) MAC="00:1E:8C:41:2A:74" ;; casa) MAC="00:11:22:33:44:55" ;; # add more aliases here... esac # do the magic :) ifconfig eth0 down ifconfig eth0 hw ether ${MAC} ifconfig eth0 up ifconfig eth0 | grep HWaddr