How to modify MAC address on Ubuntu

I take my laptop to a friend's home yesterday,his internet connection is  wired connection which the MAC and IP are binded,so I couldn't connect to internet with my laptop at his home unless I modify my laptop's MAC address .I'd never modified the MAC on Ubuntu before,then after I googled and googled,finally I found the ways to modify the MAC on Ubuntu. There are 2 ways to modify the MAC address on Ubuntu :~

The 1st way:

sudo ifconfig eth0 dow

sudo ifconfig eth0 hw xx:xx:xx:xx:xx:x

sudo ifconfig eth0 up

this method just can temporarily modify the MAC address,you have to run the commands again after every boot.

The 2nd way:

this way can permanently modify the MAC address:~

  1. cd /etc/network/init.d
  2. sudo gedit networking
  3. find out this wording : case “$” in start)
  4. insert the new MAC address below it:  ifconfig eth0 hw xx:xx:xx:xx:xx:xx
  5. save,restart computer...

Above methods are tested through on Ubuntu 8.10.

Creative Commons License's blog posts is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License