码迷,mamicode.com
首页 > 系统相关 > 详细

shell脚本检测局域网内存活主机

时间:2015-07-14 13:08:16      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:

<1>

d211 admin # for i in {3..254} ; do ping -c 1 192.168.1.$i &>/dev/null && echo 192.168.1.$i is alive ;done
192.168.1.5 is alive
192.168.1.7 is alive

<2>

fping -a -g 192.168.5.1 192.168.5.177 -s -n >lele.txt

-a   Show systems that are alive.

-g   Generate a target list from a supplied IP netmask, or a starting and ending IP. Specify the net mask or start/end in the targets portion of the command line.

ex. To ping the class C 192.168.1.x, the specified command line could look like either:

fping -g 192.168.1.0/24  or   fping -g 192.168.1.0 192.168.1.255

-s   Print cumulative statistics upon exit.                        -n   Same as -d.

-d   Use DNS to lookup address of return ping packet. This allows you to give fping a list of IP
addresses as input and print hostnames in the output.

shell脚本检测局域网内存活主机

标签:

原文地址:http://www.cnblogs.com/itcomputer/p/4645019.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!