Media Access Control (MAC) address is a unique identifier attached to most networking devices (such as router, Ethernet cards, servers, nas devices, switches and so on).
This blog posts demonstrates how to get the Media Access Control (MAC) address for an ethernet adapter under Linux, Unix, Apple OS X, and *BSD operating systems using command line options.
Use ifconfig Command To Find Out Mac Address Under Unix Like Operating Systems
You can use the ifconfig command to view the mac address of your own computer or an ethernet adapter, enter:
# ifconfig
# ifconfig eth0
Sample outputs:
eth0 Link encap:Ethernet HWaddr 00:08:9b:c4:30:31
UP BROADCAST RUNNING SLAVE MULTICAST MTU:9000 Metric:1
RX packets:312 errors:0 dropped:0 overruns:0 frame:0
TX packets:45 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26613 (25.9 KiB) TX bytes:5439 (5.3 KiB)
Interrupt:17 Memory:fe9e0000-fea00000I recommend that you pass -a option to ifconfig command to get details about all interfaces which are currently available, even if down:
# ifconfig -a
Use ip Command To Find Out Mac Address Under Linux
Most modern Linux distro prefer to use the ip command:
# ip addr show
# ip addr show eth0
# ip addr show eth1
# ip addr show bond0
Sample outputs:
4: bond0: mtu 9000 qdisc noqueue state UP
link/ether 00:08:9b:c4:30:31 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.10/24 brd 192.168.1.255 scope global bond0
inet6 fe80::208:9bff:fec4:3031/64 scope link tentative dadfailed
valid_lft forever preferred_lft foreverFind out my Mac address
Use the arp command to manipulates or displays the kernel's IPv4 network neighbour cache i.e. use the following to see your routers or other computers mac address on other end:
$ arp
Sample outputs:
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 -n
Sample outputs:
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
Where,
- -n : Shows numerical addresses instead of trying to determine symbolic host, port or user names.
arp manipulates the kernel's ARP cache in various ways. The primary options are clearing an address mapping entry and manually setting up one. The arp command works under:
- Linux
- *BSD
- UNIX
- MS Windows
- Apple OS X and other Unix like operating systems
A Note About IBM AIX Unix Users
Type the following command to find out the mac address:
# netstat -ia
A Note About HP-UX Unix Users
Type the following command to find out the mac address:
# lanscan
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 following command:
# ifconfig nc0 ether 01:02:03:04:05:06
If you are using OpenBSD or Mac OS X type the following command:
# ifconfig nc0 lladdr 01:02:03:04:05:06
Under MS-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 may use MAC addresses to control the access (a rare case these days). Therefore, if you change MAC address you may lose the connectivity to the Internet.
Page last updated at 7:44 PM, March 31, 2012.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop




![HowTo: Wake Up Computers Using Linux Command [ Wake-on-LAN ( WOL ) ]](http://s13.cyberciti.org/images/shared/rp/3/30.jpg)








{ 4 comments… read them below or add one }
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.
are you sure the arp command gives the mac address of your own interface? i think it is the mac of the destination interface.
If I change the ethernet address using `ifconfig`, how can I show the TRUE burned-in address of the NIC?
> Cocoro Cara July 29, 2011
> are you sure the arp command gives the mac address of your own interface?
> i think it is the mac of the destination interface.
You are right. “ifconfig” tells you your own MAC address, “arp” the mac address of the other end of the same cable.
John: at a network level, the MAC address is only visible on the same LAN segment – as soon as network packets pass through a router or gateway, they are not forwarded. That leaves Google as your only hope, but it’s a very slight one.