Linux (28) Python (13) Raspberry Pi (5) Bugs (3) Install (3) C (2) Brainf**k (1) HTML (1) Maths (1) Sorts (1)

Sunday, 12 July 2015

How to change your MAC address on linux at boot

I already have a post about what a MAC address is and how to find it so if you don't know what these things are look here and have a look.

How to change your MAC address at boot?
We need to edit the /etc/network/interfaces to change the MAC address of the network card before it turns on.
We do this using the pre-up command.
What the pre-up command does is it runs the command before the network card turns on and connects, this means that you will always have that MAC address.

First of all we need to be root then run
vi /etc/network/interfaces Note: Advised to make backup i.e. cp interfaces interfaces.bak
You should get something like this

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

We need to add
pre-up ifconfig eth0 hw ether 00:00:00:00:00:01
To the end of the file.
Now reboot and check your MAC address and it should be changed.

1 comment: