Created
March 5, 2013 14:32
-
-
Save kljensen/5090685 to your computer and use it in GitHub Desktop.
Discover IP & mac addresses of most devices on your network
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # First, find your broadcast address | |
| # | |
| ifconfig | |
| # - Should return something like the below, where 192.168.1.255 is | |
| # - the broadcast address | |
| # - | |
| # - eth0 Link encap:Ethernet HWaddr b8:27:eb:19:c6:01 | |
| # - inet addr:192.168.1.109 Bcast:192.168.1.255 Mask:255.255.255.0 | |
| # - UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 | |
| # - RX packets:1436 errors:0 dropped:0 overruns:0 frame:0 | |
| # - TX packets:367 errors:0 dropped:0 overruns:0 carrier:0 | |
| # - collisions:0 txqueuelen:1000 | |
| # - RX bytes:136126 (132.9 KiB) TX bytes:45970 (44.8 KiB) | |
| - | |
| # - 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:0 errors:0 dropped:0 overruns:0 frame:0 | |
| # - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 | |
| # - collisions:0 txqueuelen:0 | |
| # - RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) | |
| # Ping the broadcast address | |
| # | |
| ping -b 192.168.1.255 # quit with control-C after a little bit | |
| # - WARNING: pinging broadcast address | |
| # - PING 192.168.1.255 (192.168.1.255) 56(84) bytes of data. | |
| # - 64 bytes from 192.168.1.1: icmp_req=1 ttl=255 time=0.912 ms | |
| # - 64 bytes from 192.168.1.4: icmp_req=1 ttl=64 time=1.35 ms (DUP!) | |
| # - 64 bytes from 192.168.1.102: icmp_req=1 ttl=64 time=1.36 ms (DUP!) | |
| # - 64 bytes from 192.168.1.105: icmp_req=1 ttl=64 time=117 ms (DUP!) | |
| # - 64 bytes from 192.168.1.104: icmp_req=1 ttl=64 time=125 ms (DUP!) | |
| # - 64 bytes from 192.168.1.100: icmp_req=1 ttl=64 time=160 ms (DUP!) | |
| # ^C | |
| # Now your ARP cache will have the IP and mac addresess of any machines | |
| # that respond to broadcast pings. (Apparently windows machines don't | |
| # by default.) | |
| # | |
| # List those out. | |
| arp -a | |
| # - Outputs something like | |
| # - ? (192.168.1.1) at 0:1f:f3:c7:52:f4 on en0 [ethernet] | |
| # - ? (192.168.1.4) at d4:9a:20:c2:bc:a4 on en0 [ethernet] | |
| # - ? (192.168.1.100) at 68:9:27:62:a4:73 on en0 [ethernet] | |
| # - ? (192.168.1.102) at 58:b0:35:fd:b8:7 on en0 [ethernet] | |
| # - ? (192.168.1.104) at f8:1e:df:be:c9:d2 on en0 [ethernet] | |
| # - ? (192.168.1.105) at 60:33:4b:16:8a:69 on en0 [ethernet] | |
| # - ? (192.168.1.109) at b8:27:eb:19:c6:1 on en0 [ethernet] | |
| # - ? (192.168.1.255) at ff:ff:ff:ff:ff:ff on en0 [ethernet] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment