Skip to content

Instantly share code, notes, and snippets.

@rcanepa
Created December 29, 2016 02:12
Show Gist options
  • Select an option

  • Save rcanepa/4ca0bef7e4a36a6cb975bb4b7a412e23 to your computer and use it in GitHub Desktop.

Select an option

Save rcanepa/4ca0bef7e4a36a6cb975bb4b7a412e23 to your computer and use it in GitHub Desktop.
ARP and nmap to scan a network
Get broadcast IP
$ ifconfig | grep broadcast
Ping the IP
$ ping broadcast
Check the ARP table
$ arp -a
ARP will only list address that are on the same subnet as your computer.
To do what you want you might want to use nmap to check all computers that are connected to a certain network.
Or If all your devices are configured via DHCP—yes, DHCP can serve multiple subnets, depending on the DHCP server that is being used—you might check the DHCP leases file.
Edit as requested:
$ nmap -n -sn 10.0.0.0/24
or
$ nmap -n -sP 10.0.0.0/24
depending wich version of nmap you have (-sn is for newer versions).
replace the 10.0.0.0/25 for each subnet you have.
Example
$nmap -n -sn 192.168.1.1/24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment