全部博文(385)
分类: LINUX
2012-05-18 16:02:47
windows平台上
使用for命令,可以查询for命令的用法,直接输入 for /?
C:\>for /l %i in (1,1,25) do ping -n 1 -w 60 147.2.147.%i | find "Reply" >>d:\ping.log
备注:%i in (1,1,255) ——是遍历主机位从1 ~ 255的所有IP
-n——ping 的次数
-w ——timeout时常
192.168.0.%i ——遍历IP 自192.168.0.1 ~ 192.168.0.255的所有IP
| bat ——管道,将前面的结果通过管道输入给后面的命令
>> bat——重定向,将结果写进d:\pingall.log这个文件
C:\Documents and Settings\Administrator>type d:\ping.log
Reply from 147.2.147.11: bytes=32 time<1ms TTL=64
Reply from 147.2.147.13: bytes=32 time<1ms TTL=64
Reply from 147.2.147.14: bytes=32 time<1ms TTL=64
Reply from 147.2.147.16: bytes=32 time<1ms TTL=128
Reply from 147.2.147.22: bytes=32 time<1ms TTL=64
Reply from 147.2.147.24: bytes=32 time<1ms TTL=64
Reply from 147.2.147.28: bytes=32 time<1ms TTL=64
Reply from 147.2.147.29: bytes=32 time<1ms TTL=64
Reply from 147.2.147.31: bytes=32 time<1ms TTL=64
Reply from 147.2.147.32: bytes=32 time<1ms TTL=64
Reply from 147.2.147.35: bytes=32 time<1ms TTL=64
Reply from 147.2.147.38: bytes=32 time<1ms TTL=64
Reply from 147.2.147.40: bytes=32 time<1ms TTL=64
Reply from 147.2.147.11: bytes=32 time<1ms TTL=64
Reply from 147.2.147.13: bytes=32 time<1ms TTL=64
Reply from 147.2.147.14: bytes=32 time<1ms TTL=64
Reply from 147.2.147.16: bytes=32 time<1ms TTL=128
Reply from 147.2.147.22: bytes=32 time<1ms TTL=64
Reply from 147.2.147.24: bytes=32 time<1ms TTL=64
Linux平台上
ping一个网段,看回显,用nmap
nmap -sP -n 172.27.205.0/24