Some times it necessary to change your network MAC address on your linux box.
Unlike Windows, which requires some registry editing or even specialized tools, its just a command line away in Linux.
For example, lets change the MAC address of your first netwrok card, usually
called eth0.
Let’s swith to being the root user and view the current MAC address:-
ifconfig eth0
You should get something similiar:-
[root@rhel-5new ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 08:00:27:2C:D2:B5
inet addr:192.168.0.108 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe2c:d2b5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20545 errors:0 dropped:0 overruns:0 frame:0
TX packets:18348 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10083277 (9.6 MiB) TX bytes:7489363 (7.1 MiB)
Interrupt:11 Base address:0xd020
The MAC address is listed next to the HWAddr column, which is
08:00:27:2C:D2:B5 in this case.
We’ll change it. First shutdown the network interface.
ifconfig eth0 down
Now change it to say, 08:00:27:2C:D2:B4.
ifconfig eth0 hw ether 00:00:27:2c:d2:b4
Bring the interface back up.
ifconfig eth0 up
Finally, lets have a look at the new mac address.
[root@rhel-5new ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:00:27:2C:D2:B4
inet addr:192.168.0.108 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::200:27ff:fe2c:d2b4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20957 errors:0 dropped:0 overruns:0 frame:0
TX packets:18642 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10146055 (9.6 MiB) TX bytes:7520724 (7.1 MiB)
Interrupt:11 Base address:0xd020
You can see that the HWaddr field now reports 00:00:27:2C:D2:B4.