当前位置:网站首页>How to check whether an IP address is occupied

How to check whether an IP address is occupied

2022-06-10 05:51:00 Huang Jiajun

1. Using the command line ping To judge IP Address

windows key +R Quick open cmd Command line program , Enter the command line prompt state , Enter... On the command line “ping What you want to see is occupied ip Address ” enter .

2.ARP Cache method

If only by ping It is not rigorous to judge the existence of computers in the network , Because of firewall or filtering rules , Can make ping Unable to return correct information , in other words , Even above ping no , The other party may still be online . We can go through ARP Caching solves this problem . Because the firewall or the method of filtering packets cannot be prohibited ARP View of . The remote computer does not return ping The news of success , But it will tell the local computer to ip Address corresponding MAC Address . So you can get through ARP Cache information to investigate the case . If you can see this ip Address corresponding MAC Address , The computer is online , Corresponding , Not in ARP The cache table indicates that the computer is not online .

Write an automatic ping Of bat Script

(1) Create a new text file

(2) Enter the following code

FOR /L %%i IN (0,1,255) Do ping 192.168.11.%%i -n 1
Arp -a >d:share\arp-mac.txt

//–
The most important thing here is to use For Ordered “/L” Parameters , The specific syntax of this command is as follows :
FOR /L %variable IN (start,step,end) DO command [command-parameters]
step: It means the number of steps ping, example 5\192.168.11.1\ \192.168.11.5\ \192.168.11.10
This set represents a sequence of numbers in incremental form from start to end .
therefore ,(1,1,5) The sequence will be generated 1 2 3 4 5,(5,-1,1) The sequence will be generated (5 4 3 2 1).

Don't forget to revise ping The segment address of

Arp -a >d:share\arp-mac.txt
The address may or may not be specified
–//
(3) After the save , Save as format for all types , File name suffix .bat
(4) Double-click on the run

———————————————————————————————————————————
After executing the batch command , Will automatically Ping All in this network segment IP Address , And finally ARP The result of the command execution is returned to arp-mac.txt In the text file

原网站

版权声明
本文为[Huang Jiajun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206100542157641.html