use ifconfig to show MAC address

Asked by arnupharb

I use ifconfig command it already show mac address but i'm not sure that is my device number or wireless rounter mac address

Question information

English Edit question
Ubuntu net-tools Edit question
No assignee Edit question
Solved by:
Zach Softich
Last query:
Last reply:
Revision history for this message
Best Zach Softich (zsoftich) said :

ifconfig will show you your interfaces MAC. To find the MAC of a device on your Ethernet segment first try and ping the IP address. and then use arp to see what the resolved MAC is. For example if your IP address is and your gateway router is at Do the following commands.

ping -c 1
arp -n | grep

The output of the second command will be similar to the following. ether 00:aa:bb:cc:dd:ee C eth0

Where the first column is the IP address on your Ethernet segment. The second column is the link layer type, Ethernet in this case. Third is the MAC. And the Fifth column is the interface the MAC was resolved on.

If you are unsure of your gateway's IP address you can always run either of the following commands.

ip route | grep default


route -n | grep "^"

The output of the first command will be similar to

default via dev eth0 metric 100

The via statement shows you the IP of your gateway router and the dev statement shows the interface the gateway is found on. If multiple lines are returned, look at the metric, lowest value is the one used.

The second commands output will be similar to UG 100 0 0 eth0

The important column is the second one, which is your gateways IP and the last one, which is the interface the default gateway is found on. If multiple lines are returned look at the fifth column which is the route metric, use the one with the lowest value.


Revision history for this message
arnupharb (arnupharb-master) said :

Thanks Zach Softich, that solved my question.