You connect your computer to the customer’s network and you discover that there is no DHCP server. Now you must assign an IP address manually but if you take one that’s already assigned, you’ll cause a conflict and take down the other computer, which may be critical, resulting in disaster.
You can’t use ping, as it requires an IP address to begin with.
So, we’ll use ARP.
For this, you need to install nmap : https://nmap.org/download#windows (reboot after installing)
Assign an IP address in the APIPA range to the interface in question, like 169.254.0.1.
Then open an elevated powershell window and get the list of interfaces using command Get-NetAdapter and note the ifIndex of the interface that is connected to your customer’s network.
Next we’ll setup a temporary route :
route add [network] mask [subnet mask] 0.0.0.0 if [ifIndex]
Here’s an example :
route add 192.168.1.0 mask 255.255.255.0 0.0.0.0 if 32
Now we can use nmap to send an ARP request :
nmap -n -sn -PR --packet-trace --send-eth [IP address]
Example :
nmap -n -sn -PR --packet-trace --send-eth 192.168.1.1
Starting Nmap 7.95 ( https://nmap.org )
SENT (0.1070s) ARP who-has 192.168.1.1 tell 169.254.0.1
RCVD (0.1070s) ARP reply 192.168.1.1 is-at 11:22:33:44:55:66
Nmap scan report for 192.168.1.1
Host is up (0.00s latency).
MAC Address: 11:22:33:44:55:66 (Routerboard.com)
Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds
So we can’t use 192.168.1.1.
How about 192.168.1.2?
nmap -n -sn -PR --packet-trace --send-eth 192.168.1.2
Starting Nmap 7.95 ( https://nmap.org )
SENT (0.1050s) ARP who-has 192.168.1.2 tell 169.254.0.1
SENT (1.3230s) ARP who-has 192.168.1.2 tell 169.254.0.1
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 1.54 seconds
We get no ARP answer for 192.168.1.2, it’s most likely free to use.