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
290 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now