Solved

How do I get a list of MAC address, including ones that do not have IP addresses bound?

Posted on 2012-03-28
5
300 Views
Last Modified: 2012-06-27
How do I get a list of MAC address, including ones that do not have IP addresses bound?

ifconfig appears to only return MAC address if they have IP addresses. I need to get all of the MAC addresses, regardless of whether or not are bound.

In Windows, this is easily done with the getmac, but I have not been able to find the UNIX/Linux equivalent.
0
Comment
Question by:Mister_Tog
  • 2
  • 2
5 Comments
 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 250 total points
ID: 37778573
ip a
0
 
LVL 1

Author Comment

by:Mister_Tog
ID: 37778609
ip a appears to just return address that have IP addresses, like ifconfig -a. I need to return ethernet addresses that do not have an IP address bound.
0
 
LVL 31

Expert Comment

by:farzanj
ID: 37778648
Well, it always showed me all the MAC.

How about this?
ip maddr show
0
 
LVL 21

Accepted Solution

by:
Papertrip earned 250 total points
ID: 37778874
Which OS are you running?  Both ip a and ifconfig -a show interfaces that do not have an IP assigned on RHEL -- note eth1 in the following example.  Issuing just ifconfig without the -a however will only show interfaces that are up.

[root@phx1mmail1 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 1c:c1:de:e5:51:10 brd ff:ff:ff:ff:ff:ff
    inet 10.190.3.105/26 brd 10.190.3.127 scope global eth0
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether 1c:c1:de:e5:51:12 brd ff:ff:ff:ff:ff:ff

[root@phx1mmail1 ~]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 1C:C1:DE:E5:51:10  
          inet addr:10.190.3.105  Bcast:10.190.3.127  Mask:255.255.255.192
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:56068823208 errors:0 dropped:0 overruns:0 frame:0
          TX packets:47944747928 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:21919365848940 (19.9 TiB)  TX bytes:23347617517672 (21.2 TiB)
          Interrupt:130 Memory:f8000000-f8012800 

eth1      Link encap:Ethernet  HWaddr 1C:C1:DE:E5:51:12  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:138 Memory:f6000000-f6012800 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:3163770555 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3163770555 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:355390764000 (330.9 GiB)  TX bytes:355390764000 (330.9 GiB)

[root@phx1mmail1 ~]# 

Open in new window

0
 
LVL 1

Author Closing Comment

by:Mister_Tog
ID: 37789449
It looks like you are right, ifconfig -a works. I should not that "ip a" doesn't seem to work on Solaris.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question