Hello,
I have been tinkering within Powershell and decided to try to automate the process to find unused IP addresses.....
I.e., Pinging the range 192.168.1.100-192.168.1.105 and then executing arp -a
-------------- Here is the Powershell .ps1:
#Ping an IP address range by IP
#Then use ARP -a to flag invalid IPs
$networkIP = "192.168.1."
For ($i=100; $i -lt 105; $i++)
{
$IP = $networkIP + $i
ping $IP
}
arp -a
----------------Here are the results:
Pinging 192.168.1.100 with 32 bytes of data:
Reply from 192.168.1.100: bytes=32 time<1ms TTL=64
Reply from 192.168.1.100: bytes=32 time<1ms TTL=64
Reply from 192.168.1.100: bytes=32 time<1ms TTL=64
Reply from 192.168.1.100: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.1.100:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Pinging 192.168.1.101 with 32 bytes of data:
Reply from 192.168.1.101: bytes=32 time<1ms TTL=64
Reply from 192.168.1.101: bytes=32 time<1ms TTL=64
Reply from 192.168.1.101: bytes=32 time<1ms TTL=64
Reply from 192.168.1.101: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.1.101:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Pinging 192.168.1.102 with 32 bytes of data:
Reply from 192.168.1.102: bytes=32 time<1ms TTL=128
Reply from 192.168.1.102: bytes=32 time<1ms TTL=128
Reply from 192.168.1.102: bytes=32 time<1ms TTL=128
Reply from 192.168.1.102: bytes=32 time<1ms TTL=128
Ping statistics for 192.168.1.102:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Pinging 192.168.1.103 with 32 bytes of data:
Reply from 192.168.1.102: Destination host unreachable.
Reply from 192.168.1.102: Destination host unreachable.
Reply from 192.168.1.102: Destination host unreachable.
Reply from 192.168.1.102: Destination host unreachable.
Ping statistics for 192.168.1.103:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Pinging 192.168.1.104 with 32 bytes of data:
Reply from 192.168.1.102: Destination host unreachable.
Reply from 192.168.1.102: Destination host unreachable.
Reply from 192.168.1.102: Destination host unreachable.
Reply from 192.168.1.102: Destination host unreachable.
Ping statistics for 192.168.1.104:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Interface: 192.168.1.102 --- 0xa
Internet Address Physical Address Type
192.168.1.1 94-10-3e-00-34-95 dynamic
192.168.1.100 00-1e-8f-99-ef-d1 dynamic
192.168.1.101 00-90-a9-b3-79-bc dynamic
192.168.1.255 ff-ff-ff-ff-ff-ff static
224.0.0.2 01-00-5e-00-00-02 static
224.0.0.22 01-00-5e-00-00-16 static
224.0.0.251 01-00-5e-00-00-fb static
224.0.0.252 01-00-5e-00-00-fc static
239.255.255.250 01-00-5e-7f-ff-fa static
255.255.255.255 ff-ff-ff-ff-ff-ff static
-------------End of results.
Not really sure about how to interpret the results even if I have all of the commands etc. correct. "Destination host unreachable" would imply an IP not it use but could also mean a static IP device just not online.
Should arp -a be truly at the end of the ping loop or executed after each ping?
Just trying to learn here. Thanks.