How to ping multiple ip address

依然范特西╮ 提交于 2019-12-12 04:38:13

问题


I want to ping 500 times three different ip address SIMULTANEOUSLY. If these pings are not the same time that will be an easy question. Somebody may say about open three cmd and start to ping your ip in each one.... ummm thats work But I'am finding to smarter way? I searched and I found one way in Linux, I'm working on Win7.


回答1:


If you want to compare delays afterwards you could so something like this:

@echo off

setlocal

start "" "%COMSPEC%" /c ping -n 500 192.168.1.23 ^>log1.txt
start "" "%COMSPEC%" /c ping -n 500 192.168.1.42 ^>log2.txt
start "" "%COMSPEC%" /c ping -n 500 192.168.1.113 ^>log3.txt

The 3 log files contain the output of each ping command.




回答2:


@echo off
for %%a in (1.1.1.1 2.2.2.2 3.3.3.3) do (
start ping -n 500 %%a
)



回答3:


You can install a utility fping which works in a round-robin way to ping each ip address. You can install it by:

sudo apt install fping

Then you can ping multiple addresses using one-liner:

fping <ip1> <ip2> <ip3>

It can also be used to run multiple ip addresses written down in a file.




回答4:


You can try script (I am the author) below to run command(s) against multiple targets (IP/Names). Commands are not limited to Ping only but can be any command like tracert/traceroute, ncat, whatever you can run from terminal. Tested on Linux and windows - for windows script packed in .exe file for the ease of use.

For Windows: ccmd.exe -c 500 -ts 8.8.8.8,bbc.com,8.8.4.4/31 -D -b 20

For Linux: ccmd.py -c 500 -ts 8.8.8.8,bbc.com,8.8.4.4/31 -D -b 20

-ts - is a coma separated string of targets to execute commands against
-c - count of times to execute command
-D - tells the script to get and print DNS info on the screen
-b - regulates the length of results printed to screen
all commands executed in (semi)parallel using python threading module (thread count can be set with -t argument).

Script saves logs into "LOGS" directory.

Example output for Windows

Source: https://github.com/apraksim/ccmd.git




回答5:


for those who's using Mac OS-X or Linux and want to ping multiple hosts: I've just released ping-xray which facilitates multiple hosts pinging. Tried to make it as visual as possible under ascii terminal plus it creates CSV logs with exact millisecond resolution for all targets.

https://dimon.ca/ping-xray/

Hope you'll find it helpful. Tool is based on open source "fping" and adds ascii "gui" via bash curses to make output a bit more human-readable.




回答6:


On Macbook:
Open terminal,

vim ping.sh

in the vim, type

for i in 35.x.x.x 35.x.x.x
do
ping -c 2 $i
done

save and quite
to run the script, type:

sh ping.sh 


来源:https://stackoverflow.com/questions/18622776/how-to-ping-multiple-ip-address

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!