linux poison RSS
linux poison Email

How to Find and Change Network Card MAC Address on Ubuntu Linux

A Media Access Control address or MAC address is a unique code assigned to every piece of hardware that connects to the Internet. Internet capable phones, Network Interface Cards for desktop or notebook computers, Wireless Access Cards, and even some memory cards are among the devices that are assigned MAC addresses.

When a manufacturer creates a network capable piece of hardware they will assign the MAC address which will usually begin with a code that is tied to the manufacturer. The MAC address will be unique to every device, even two devices of the same type.

A device’s MAC address is composed of six pairs of hexadecimal numbers. The numbers are separated by colons as in the following example:


Finding MAC Address:
On Ubuntu Linux systems, the ethernet device is typically called eth0. In order to find the MAC address of the Ethernet device, you must type ifconfig -a and look up the relevant info. For example:

ifconfig -a
eth0    Link encap:Ethernet  HWaddr 00:19:d1:18:ba:a9
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::209:d2fe:fx18:baa6/64 Scope:Link
          RX packets:15973 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18361 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:10261186 (10.2 MB)  TX bytes:5729714 (5.7 MB)
          Interrupt:21 Base address:0xde00

The MAC address is the HWaddr listed on the first line. In the case of this machine, it is 00:19:d1:18:ba:a9

Changing MAC Address:
To change MAC address setting, you need to edit the /etc/network/interfaces file.
sudo gedit /etc/network/interfaces
You should see the line for your network interface, which is usually eth0. If you have dhcp enabled, it will look like this:
auto eth0
iface eth0 inet dhcp
Just add another line below it to make it look something like this:
auto eth0
iface eth0 inet dhcp
       hwaddress ether 01:02:03:04:05:06
Obviously you would want to choose something else for the MAC address, but it needs to be in the same format. You will need to restart networking or reboot to take effect.
sudo /etc/init.d/networking restart


Post a Comment

Related Posts with Thumbnails