Linux or UNIX: How to find out or display the Ethernet Address (MAC)

Media Access Control (MAC) address is a unique identifier attached to most networking devices (such as router, Ethernet cards etc).

This address is some time required. For example, there is famous engineering expensive software. This software needs your unique MAC address to issue you license and necessary software installation keys. Some time MAC address used for filtering purpose (firewall or sniffers) or diagnosing network problems .

Task: Find out my Mac address

Use arp command.
$ arpOutput:

Address                  HWtype  HWaddress           Flags Mask            Iface
vpn.dhcp.cyberciti.org   ether   00:76:C7:76:F0:01   C                     eth0
desktop.cyberciti.org    ether   00:08:5C:00:00:01   C                     ra0

$ arp -nOutput:

Address                  HWtype  HWaddress           Flags Mask            Iface
10.5.123.1               ether   00:76:C7:76:F0:01   C                     eth0
192.168.1.5              ether   00:08:5C:00:00:01   C                     ra0

arp manipulates the kernel's ARP cache in various ways. The primary options are clearing an address mapping entry and manually setting up one. arp command works under

  • Linux
  • *BSD
  • UNIX
  • MS Windows

Where,

  • -n : Shows numerical addresses instead of trying to determine symbolic host, port or user names.

Task: Changing MAC addresses

Please note that physical MAC addresses are permanent, but several mechanisms allow modification (read as spoofing) of the MAC address that is reported by the operating system.

Under Linux you can type the command to setup a new MAC address :
# ifconfig eth0 down
# ifconfig eth0 hw ether 01:02:03:04:05:06

Where,

  • 01:02:03:04:05:06 - Mac address

If you are using FreeBSD type the command:
# ifconfig nc0 ether 01:02:03:04:05:06

If you are using OpenBSD or Mac OS X type the command:
# ifconfig nc0 lladdr 01:02:03:04:05:06

If you are using Windows 2003/XP:
Under Windows XP or 2003 server the MAC address can be changed in the Ethernet adapter's Properties menu > Advanced tab > Look for MAC Address > Locally Administered Address > Ethernet Address > Physical Address option.

Also, note that some ISP's use MAC addresses to control the access (this is rare case these days). Therefore, if you change MAC address you may lose the connectivity.

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 1 comment… read it below or add one }

1 John 01.17.09 at 8:43 pm

I would like to find a tool to search for mac addresses on the internet. My iMac was stolen and I know the mac address and thought I might locate it.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post: How to find, use, and manage Linux documentations locally and on the Internet

Next post: The correct version of one or more libraries needed to run VMware Server may be missing error and solution