Skip to content

February 27, 2009

How to Change Mac Address in Linux (Ubuntu/Kubuntu)

Ubuntu/Kubuntu Tutorial.

Some times we require to change MAC address (Physical Address of network card).This can be temporarily or permanently. Here is a tutorial which illustrates changing  of MAC address in linux/ubuntu/kubuntu

To change the MAC address temporarily

Open terminal and type

ifconfig eth0 down

This command brings the network down 

Later type the following command.

ifconfig eth0 hw ether Your Mac Address

For example, it will be like

ifconfig eth0 hw ether 001B2F1359C3

Later bring the network up by the following command.

ifconfig eth0 up

Now type

dhclient

This DHCP protocol allows your computer to contact a central server which main- tains a list of IP addresses which will be assigned to you.

Now your connection should be up with a new MAC address

If you still find a problem with connection, Just repeat the process after taking the LAN wire connection

If you want to access internet with the new mac address all the time, it would be difficult to repeat the process every time after starting the system

So we need to edit /etc/init.d/bootmisc.sh

Anything in the file loads after the regular boot process.So we can repeat the temporary process here.

Open terminal and type

sudo gedit /etc/init.d/bootmisc.sh

On the bottom of the page, insert the following piece of code

killall dhclient
killall dhclient3
ifconfig eth0 down
ifconfig eth0 hw ether 001B2F1359C3
ifconfig eth0 up
/sbin/dhclient
/sbin/dhclient3

So putting this in the file will change the MAC address everytime the system starts.

Read more from How to, Linux

Comments are closed.