?
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
Medium Priority
?
306 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 1000 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

809 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