Ping all addresses in network, windows

前端 未结 11 1505
庸人自扰
庸人自扰 2021-01-30 00:14

Is it possible in windows cmd line to check all of the network addresses (with ping or similar) to see which ones are taken/ have active devices:

ie. something that does

相关标签:
11条回答
  • 2021-01-30 00:31

    All you are wanting to do is to see if computers are connected to the network and to gather their IP addresses. You can utilize angryIP scanner: http://angryip.org/ to see what IP addresses are in use on a particular subnet or groups of subnets.

    I have found this tool very helpful when trying to see what IPs are being used that are not located inside of my DHCP.

    0 讨论(0)
  • 2021-01-30 00:34

    Open the Command Prompt and type in the following:

    FOR /L %i IN (1,1,254) DO ping -n 1 192.168.10.%i | FIND /i "Reply">>c:\ipaddresses.txt
    

    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.

    FOR /L %i IN (1,1,254) DO ping -a -n 1 192.168.10.%i | FIND /i "Reply">>c:\ipaddresses.txt
    

    This is from Here

    Hope this helps

    0 讨论(0)
  • 2021-01-30 00:38
    @ECHO OFF
    
    IF "%SUBNET%"=="" SET SUBNET=10
    
    :ARGUMENTS
    ECHO SUBNET=%SUBNET%
    ECHO ARGUMENT %1 
    IF "%1"=="SUM" GOTO SUM
    IF "%1"=="SLOW" GOTO SLOW
    IF "%1"=="ARP" GOTO ARP
    IF "%1"=="FAST" GOTO FAST
    
    REM PRINT ARP TABLE BY DEFAULT
    :DEFAULT
    ARP -a
    GOTO END
    
    REM METHOD 1 ADDRESS AT A TIME
    :SLOW
    ECHO START SCAN
    ECHO %0 > ipaddresses.txt
    DATE /T >> ipaddresses.txt
    TIME /T >> ipaddresses.txt
    FOR /L %%i IN (1,1,254) DO ping -a -n 2 192.168.%SUBNET%.%%i | FIND /i "TTL="  >> ipaddresses.txt
    GOTO END
    
    REM METHOD 2 MULTITASKING ALL ADDRESS AT SAME TIME
    :FAST
    ECHO START FAST SCANNING 192.168.%SUBNET%.X
    set /a n=0
    :FASTLOOP
    set /a n+=1
    ECHO 192.168.%SUBNET%.%n%
    START CMD.exe /c call ipaddress.bat 192.168.%SUBNET%.%n% 
    IF %n% lss 254 GOTO FASTLOOP
    GOTO END
    
    :SUM
    ECHO START SUM
    ECHO %0 > ipaddresses.txt
    DATE /T >> ipaddresses.txt
    TIME /T >> ipaddresses.txt
    FOR /L %%i IN (1,1,254) DO TYPE ip192.168.%SUBNET%.%%i.txt | FIND /i "TTL=" >> ipaddresses.txt
    FOR /L %%i IN (1,1,254) DO DEL ip192.168.%SUBNET%.%%i.txt
    type ipaddresses.txt
    GOTO END
    
    :ARP
    ARP -a >> ipaddresses.txt
    type ipaddresses.txt
    GOTO END
    
    
    :END
    ECHO DONE WITH IP SCANNING
    ECHO OPTION "%0 SLOW" FOR SCANNING 1 AT A TIME
    ECHO OPTION "%0 SUM" FOR COMBINE ALL TO FILE
    ECHO OPTION "%0 ARP" FOR ADD ARP - IP LIST
    ECHO PARAMETER "SET SUBNET=X" FOR SUBNET
    ECHO.
    
    0 讨论(0)
  • 2021-01-30 00:40

    Some things seem appeared to have changed in batch scripts on Windows 8, and the solution above by DGG now causes the Command Prompt to crash.

    The following solution worked for me:

    @echo off
    set /a n=0
    :repeat
    set /a n+=1
    echo 192.168.1.%n%
    ping -n 1 -w 500 192.168.1.%n% | FIND /i "Reply">>ipaddresses.txt
    if %n% lss 254 goto repeat
    type ipaddresses.txt
    
    0 讨论(0)
  • 2021-01-30 00:41

    This post asks the same question, but for linux - you may find it helpful. Send a ping to each IP on a subnet

    nmap is probably the best tool to use, as it can help identify host OS as well as being faster. It is available for the windows platform on the nmap.org site

    0 讨论(0)
  • 2021-01-30 00:43

    aping can provide a list of hosts and whether each has responded to pings.

     aping -show all 192.168.1.*
    
    0 讨论(0)
提交回复
热议问题