How to find ethernet / MAC address on Linux

In Linux networking is easy, you just have to know how. We will discuss below how you can find your own machine's MAC address for all the attached ethernet cards as well as MAC addresses on other machines in the network.

How to find Ethernet / MAC Address of ethernet cards in your machine
ifconfig -a
In the output look for lines starting with eth0, eth1 etc. You will find an entry like this:
eth0      Link encap:Ethernet  HWaddr 00:17:31:2B:A3:7C
The ethernet address is at the very end (shown here in italics) for the Ethernet card eth0.
Normally each machine has one ethernet card. However there could be multiple ethernet cards designated as eth1, eth2, eth3 etc.
You can similarly find the MAC address for each.
How to find Ethernet / MAC address of other machines in your intranet
arp
You will have entries in the form:
Address                  HWtype  HWaddress           Flags Mask            Iface
172.16.0.69              ether   00:19:D1:3E:DD:9C C                     eth0
Not only can you get the MAC address but also the associated IP address and network interface of the machine this way.

No comments: