Find All Active/Used IP Addresses on Your Network
There is a really neat way that you can quite easily find all active/used IP Addresses on your network without the need for any third party applications or worse, pinging each IP Address individually.
Open the Command Prompt and type in the following:
Change 192.168.10 to match you own network.
By using -n 1 you are asking for only 1 packet to be sent to each computer instead of the usual 4 packets.
The above command will ping all IP Addresses on the 192.168.10.0 network and create a text document in the C:\ drive called ipaddresses.txt. This text document should only contain IP Addresses that replied to the ping request.
Although it will take quite a bit longer to complete, you can also resolve the IP Addresses to HOST names by simply adding -a to the ping command.
GUI Based Discovery
If you’re not confident using the command prompt, there are alternative GUI based applications that you can use.
TCPNetView – No installation is required, simply double-click the executable and away it goes. It will find all active IP Addresses on the subnet you are currently connected too.
- Download Here
Advanced IP Scanner – If you are after something with a few more options and features, Advanced IP Scanner is an excellent free utility.
- More Information Here
Sample output problem for me:
C:\>ping -n 1 192.168.10.1 | FIND /i “Reply” 1>>c:\ipaddresses.txt
FIND: Parameter format not correct
WinXP Pro SP3 gives me an error. I’m not sure how the number 1 gets put after “Reply” string in the command by the For loop but it does and breaks it.
ANY HELP WOULD BE NICE? seems like the FIND Comand “reply” comes back with a parameter ERROR I really would like to know how to make this work. Thanks in advance
hmmm – working fine for me.
perhaps try wrapping the quotes around “Reply” in more quotes…
e.g. find /i “”"Reply”"”
see if that makes any difference.
please I’m looking for a command that i can type the cmd+ipaddress in the dos screen then return the computer name
Maybe try:
nbtstat -A ipaddress
or check out the nslookup command.
Sample output problem for me:
C:\>ping -n 1 192.168.10.1 | FIND /i “Reply” 1>>c:\ipaddresses.txt
FIND: Parameter format not correct
WinXP Pro SP3 gives me an error. I’m not sure how the number 1 gets put after “Reply” string in the command by the For loop but it does and breaks it.
Replace the “ with ” and it will work (just delete them from the command and type them again).
Sorry, when posting the character ” changes. So replace the ” character before and after the Reply with the double quote character. On my keyboard is above the comma ,
which command is used to show all ip in lan in cmd
That is brilliant. Thank you very much.
Regards
Tom
@me too
Your copy and paste of the command probably included smart quotes – paste your copy of the command into notepad and replace the “ ” and with ” s.
Try
nmap -sP 192.168.10.0/24
It’s simple and will tell you all the machines that are up in an instant
hm,, little slow but great batch script. thanks man
am still having aproble with the codeC:\>ping -n 1 192.168.10.1 | FIND /i “Reply” 1>>c:\ipaddresses.txt
FIND: Parameter format not correct what should i do?????????????
@Jeb
Paste the command in a text editor and delete and re-add the quotes. The quotes you copy are some HTML encoded double quote.
Make sure to leave a space before and after the redirection operator >>
This will do:
FOR /L %i IN (1,1,254) DO ping -n 1 192.168.10.%i | FIND /I “Reply” >> c:\ipaddresses.txt
how do you do this on a mac?
I know I have the administrative privileges, but I still get “access denied”.
Windows 7.
C:\Users\Alex>for /l %i in (1,1,254) do ping -n 1 192.168.1.%i | find /i “reply”
>>c:\ipaddress.txt
C:\Users\Alex>ping -n 1 192.168.1.1 | find /i “reply” 1>>c:\ipaddress.txt
Access is denied.
try arp -a :)
I get an access denied error
the nmap one gives me: ‘nmap’ is not recognized as an internal or external command, operable program or batch file.
I used the
FOR /L %i IN (1,1,254) DO ping -n 1 192.168.10.%i | FIND /I “Reply” >> c:\ipaddresses.txt
and I get an error that goes by so quick I can’t see it. Can someone please attempt this in a batch and resolve the issue. I actually have commands that find the IP address and gatewa and save them to variables, I pass that into this code (instead of the 192.168.10.%1) but I need to remove the last octect. (don’t know how to do that either.) I don’t need to pass it into a file, just display the used IPs and resolve the name ( -a)
Would someone please put that in a batch and test it? This is a server test utility to see if the DNS is working.
I came up with this. I need to find a way to show all IPs being used too.
@echo off
color 0A
cls
:ipaddress
::Get IP address and save it to ip
for /f “tokens=1-2 delims=:” %%a in (‘ipconfig^|find “IP Address”‘) do set ip=%%b
set ip=%ip:~1%
:gateway
::Get Gateway address and save it to gateway
for /f “tokens=1-2 delims=:” %%a in (‘ipconfig^|find “Gateway”‘) do set gateway=%%b
set gateway=%gateway:~1%
:DNS
::Get Gateway address and save it to gateway
for /f “tokens=1-2 delims=:” %%a in (‘ipconfig^|find “DNS”‘) do set dns=%%b
set dns=%dns:~1%
cls
echo Your IP address is %ip%
echo Your router address is %gateway%
echo Your DNS address is %dns%
echo Your computers name is %computername%
pause
::cls
::ipconfig /all
::pause
cls
echo Now ping the gateway first
ping %gateway% -a
pause
cls
echo Now ping the ipaddress and see if the DNS is working
echo If you don’t see the computer’s name then the DNS isn’t resolving host names
ping %ip% -a
pause
cls
::enter the command for this computer’s name
echo edit this file to include the code for this computer’s name
pause
goto ipaddress
:end
i get a “access denied” after typing FOR /L %i IN (1,1,254) DO ping -n 1 192.168.10.%i | FIND /I “Reply” >> c:\ipaddresses.txt … any suggestions what to do? thx.
Under Windows Vista, 7 & Server 2008 you need to run this from an elevated command prompt, otherwise you’ll get the ‘Access Denied’ error. To do this, right-click on Command Prompt and select ‘Run as administrator’.
jay, et al., if you do not have permission to write to your root directory, try:
@echo off & For /L %%i in (1,1,255) do @ping -n 1 192.168.10.%%i | find “Request” >nul & if errorlevel 1 @echo 192.168.10.%%i >> %USERPROFILE%\Desktop\ipaddresses.txt
Alternately, you could put the above command in a bat or cmd file and test for any subnet on the command line. Open up notepad and save the following…
@echo off & For /L %%i in (%4,1,255) do @ping -n 1 %1.%2.%3.%%i | find “Request” >nul & if errorlevel 1 @echo %1.%2.%3.%%i >> %USERPROFILE%\Desktop\ipaddresses.txt
… into a file which you save as SUBSCAN.CMD or [your_filename].bat or whatever (using .bat or .cmd extension in WinXP & up), and save the file somewhere in your PATH folders (to find these use the PATH command on the command line — usually C:\WINDOWS and C:\WINDOWS\System32 are fine). Then type:
subscan 192 168 10 0
to run the batch file. Note that you are replacing all dots (“.”) with spaces
(” “).
Enjoy!
Apologies, that first one should be:
@echo off & For /L %i in (1,1,255) do @ping -n 1 192.168.10.%%i | find “Request” >nul & if errorlevel 1 @echo 192.168.10.%i >> %USERPROFILE%\Desktop\ipaddresses.txt
I had %%i incorrectly before which should be %i. The %%i in the second one is correct since it is in a batch file.
Oh, and the arp -a command only gives you your computer’s IPs, which you can get with ipconfig /all as well.
There is also a program called “Advanced IP Scanner (v2.1.200)” which you can download free from radmin.com if you prefer a GUI. It shows IPs/NETBIOS names in your subnets and has some options.
Enjoy!
Is there a way to input all of my IP ranges/subnets into this command or any other and get the same results. Looking for away to get all in use IPs on my network which has both XP/WIN 7 OS’s.
@jay
before opening command prompt, right click and select open as administrator.
go to cmd and follow this:
1.write>>: tracert http://www.google.com
find all ip addresses working or existing at that time
100% for me
arp -a worked on my macbook pro early 2008@lina