Saturday, March 6, 2010

Change your MAC address in Linux

 

In a local area network (LAN) or other network, the MAC (Media Access Control) address is your computer's unique hardware number. (On an Ethernet LAN, it's the same as your Ethernet address.) When you're connected to the Internet from your computer (or host as the Internet protocol thinks of it), a correspondence table relates your IP address to your computer's physical (MAC) address on the LAN.

MAC addresses are 12-digit hexadecimal numbers (48 bits in length). By convention, MAC addresses are usually written in one of the following two formats:

MM:MM:MM:SS:SS:SS

MM-MM-MM-SS-SS-SS

The first half of a MAC address contains the ID number of the adapter manufacturer. These IDs are regulated by an Internet standards body (see sidebar). The second half of a MAC address represents the serial number assigned to the adapter by the manufacturer.

In the example,

00:A0:C9:14:C8:29

The prefix : 00A0C9

indicates the manufacturer is Intel Corporation.

If you wish to change your MAC address in Linux, all you have to do is bring the interface down then use the hw ether switch:

ifconfig eth0 down

ifconfig eth0 hw ether 02:01:02:03:04:08

ifconfig eth0 up

nice but if you want your pc to change its MAC address on boot add that to a script in /etc/init.d/ folder, and also add symbolic link(ln) to /etc/rc2.d, /etc/rc3.d, /etc/rc4.d, /etc/rc5.d which refers to the script in /init.d/

script:

#!/bin/bash

ifconfig eth0 down

ifconfig eth0 hw ether 02:01:02:03:04:08

ifconfig eth0 up

/etc/init.d/networking restart

 
Things You Should Know About Linux !!!