As a network administrator, when troubleshooting DHCP issues on Windows operating systems, you sometimes need to find out which addresses within a certain range are not in use. I previously introduced one method: open a command prompt window and call the ping command within a For…in…Do loop.
For example, to find out which addresses in the range 192.168.1.1 to 192.168.1.100 are not in use, you can use this command: For /L %f in (1,1,100) Do Ping.exe -n 2 192.168.1.%f
This command reports all IP addresses within the specified range, whether in use or unused, forcing users to scroll through large amounts of content in the authentication system command line window. Actually, we can completely avoid this hassle by simply creating a batch file that only returns the unused IP addresses and then outputs the command results
to a text file. Here is how to track IP addresses on a Windows system:
Open Notepad and enter the following commands in the window:
@Echo off
date /t > IPList.txt
time /t >> IPList.txt
echo =========== >> IPList.txt
For /L %%f in (1,1,100) Do Ping.exe -n 2 192.168.1.%%f 銆€ Find
"Request timed out." && echo 192.168.1.%%f Timed Out >>
IPList.txt && echo off
cls
Echo Finished!
@Echo on
Notepad.exe IPList.txt
Save this file as IPTracker.bat and close Notepad.
It is important to note that in this batch file, the entire For…In…Do command consists of several commands connected by “&&”. The command starts with “For” and ends with “Off”, and the entire command must be on a single line. Of course, if you want to use this method, you need to replace the example IP
addresses with your own IP addresses.
In the future, if you need to resolve DHCP issues, you can locate and double-click the IPTracker.bat file in a browser window, then launch an IP address tracking tool. This batch file only finds unused IP addresses and saves