Is there some easy way to find out mac address of all machines on my network rather than doing an SSH into each and ifconfig | grep HWaddr
if there are 300 machines on network I really need some easy solution.
Is there some easy way to find out mac address of all machines on my network rather than doing an SSH into each and ifconfig | grep HWaddr
if there are 300 machines on network I really need some easy solution.
You can use nmap to run a ping scan.
Edit:
A sed script to filter the output to IP -> MAC - put this in a file.
and use it like this
Use nmap. Important to run it as root so you get the MAC addresses. Example:
Will scan 192.168.1.1 - 192.168.1.255. Look up CIDR notation on wiki if you're not familiar with this subnet notation.
You should be able to get nmap from the repos of any recentish Linux distro, e.g.
or
A sample output from my network:
Try this command:
As long as you run this command from a host in the same network segment,
nmap
will report all of the MAC address for each host is discovers.For example:
For the MAC addresses I need to be root on my Ubuntu box. Also a simple method for a single host is just to ping it and look at the arp table with
arp -a
if you wanted to only use commands normally included in the initial install of a distribution:Depending on your LAN topology, your best shot may be to display the MAC address table on your switches.
So for example, if your switch infrastructure is Cisco, you may try a
on every switch.
If you have many switches, you may automate this task through the use of SNMP.
Another option and (again) depending on your topology and your type of networking equipment, you may also try to get the mac addresses of your devices displaying the arp table on your routers.
With either of this two methods you will also obtain the list of mac addresses of any devices that are connected to your network infraestructure: PCs, printers, access points, etc. In the first case, even of devices without an IP address. This may or may not be want you want, but it may worth a try.
Maybe arp-scan is also an option:
See for a example here: Arp-scan User Guide
Since you mentioned about ssh into machines in your network, you can also use this shorty:
You can use a program called SIW, it's free and scans the network requiring no permissions, or args.
URL: http://www.gtopala.com/
Available in .exe, or full installation.