<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.

eg:

i161 bijiao # fping -a -g 192.168.5.4 192.168.5.254 -s >jiancela.txt  2> /dev/null      //错误信息不进行输出

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

ICMP Host Unreachable from 192.168.5.161 for ICMP Echo sent to 192.168.5.4
ICMP Host Unreachable from 192.168.5.161 for ICMP Echo sent to 192.168.5.5
ICMP Host Unreachable from 192.168.5.161 for ICMP Echo sent to 192.168.5.6
ICMP Host Unreachable from 192.168.5.161 for ICMP Echo sent to 192.168.5.7
ICMP Host Unreachable from 192.168.5.161 for ICMP Echo sent to 192.168.5.8
ICMP Host Unreachable from 192.168.5.161 for ICMP Echo sent to 192.168.5.9
ICMP Host Unreachable from 192.168.5.161 for ICMP Echo sent to 192.168.5.10
ICMP Host Unreachable from 192.168.5.161 for ICMP Echo sent to 192.168.5.11
ICMP Host Unreachable from 192.168.5.161 for ICMP Echo sent to 192.168.5.12
ICMP Host Unreachable from 192.168.5.161 for ICMP Echo sent to 192.168.5.13
ICMP Host Unreachable from 192.168.5.161 for ICMP Echo sent to 192.168.5.14

。。。。。。。。。。。。。。

251 targets
65 alive
186 unreachable
0 unknown addresses

0 timeouts (waiting for response)
369 ICMP Echos sent
65 ICMP Echo Replies received
185 other ICMP received

0.02 ms (min round trip time)
0.32 ms (avg round trip time)
2.40 ms (max round trip time)
9.232 sec (elapsed real time)

i161 bijiao # cat jiancela.txt
192.168.5.101
192.168.5.120
192.168.5.121
192.168.5.157
192.168.5.158
192.168.5.159
192.168.5.160
192.168.5.161

shell脚本检测局域网内存活主机的更多相关文章

  1. 使用 Python 查看局域网内存活主机

    1 安装 (如果误用了 pip insatll nmap的话,要先 pip uninstall nmap) pip install python-nmap Nmap 是一款用于网络发现和安全审计的网络 ...

  2. 多线程shell脚本检测主机存活

    局域网中分了很多网段,而IP地址使用情况也未知,前期也没有规划和记录,当新的主机需要使用固定IP的时候,能否第一时间知道哪个IP空闲就显得很重要了,如果一个一个去ping的话太浪费时间. 这里分享一个 ...

  3. 生产环境Shell脚本Ping监控主机是否存活(多种方法)

    在网上针对shell脚本ping监控主机是否存活的文档很多,但大多都是ping一次就决定了状态,误报率会很高,为了精确判断,ping三次不通再发告警,只要一次ping通则正常.于是,今天中午抽出点时间 ...

  4. arp命令(windows ),nmap查看局域网内所有主机IP和MAC

    ARP命令详解 ARP是一个重要的TCP/IP协议,并且用于确定对应IP地址的网卡物理地址.实用arp命令,我们能够查看本地计算机或另一台计算机的ARP高速缓存中的当前内容.此外,使用arp命令,也可 ...

  5. 局域网内其他主机如何访问运行在宿主机的虚拟机中的Django项目(转)

    局域网内其他主机如何访问运行在宿主机的虚拟机中的Django项目     1.在宿主机cmd中查看宿主机的ip(注意区分主机中虚拟机的ip) 我连的是无线,IP如下 2.在Django项目的mysit ...

  6. 访问局域网内其他主机的VMware虚拟机上的mysql数据库和redis缓存

    上一篇写了访问局域网内其他主机的虚拟机上的项目 ,现在说说访问局域网内其他主机的虚拟机上的数据库和缓存 博主使用的linux是Ubuntu16.04: 一.安装数据库和缓存 这里连接的数据库和缓存以m ...

  7. Linux 下查看局域网内所有主机IP和MAC

    linux环境下,执行namp对局域网扫描一遍,然后查看arp缓存表就可以知道局域内ip对应的mac.namp比较强大也可以直接扫描mac地址和端口,执行扫描之后就可以在/proc/net/arp查看 ...

  8. windows CMD命令查看局域网内所有主机名及IP

    COLOR 0A CLS @ECHOOff Title查询局域网内在线电脑IP :send @ECHO off&setlocal enabledelayedexpansion ECHO 正在获 ...

  9. linux shell脚本检测硬盘磁盘空间 邮件报警

    使用 http://www.weiruoyu.cn/?p=368 shell脚本监控硬盘空间剩余空间 邮件报警 1.先观察一下磁盘,和如何使用脚本 [root@localhost ~]# df -h ...

随机推荐

  1. iOS开发小技巧--利用苹果官方API播放视频(方法已经过时,了解一下)

  2. zabbix_监控_端口

        目的:监控web主机80端口是否在供提服务.如果不在发出报警.配置:    1.添加监控项(Items).        打开zabbix web管理界面:选择"Configurat ...

  3. poj2406 KMP

    kmp简单题 找循环节.由于KMP的next[]数组,所以可以考虑最后一组的情况,及next[n]的值:n-next[n]的值表示一个循环节. 如果n%(n-next[n])!=0表明该循环不成立.不 ...

  4. Java基础-常量池

    在class文件中,“常量池”是最复杂也最值得关注的内容. Java是一种动态连接的语言,常量池的作用非常重要,常量池中除了包含代码中所定义的各种基本类型(如int.long等等)和对象型(如Stri ...

  5. 本地的手机号码归属地查询-oracle数据

    最近做的项目中,有个功能是手机归属地查询,因为项目要在内网下运行,所以不能用提供的webservice,只好在网上找手机归属地的数据,很多都是access的,我们的项目是用oracle,只好自己转吧, ...

  6. Netbeans 中的编译器相关配置

    gcc-core:C 编译器 gcc-g++:C++ 编译器 gdb:GNU 调试器 make:"make" 实用程序的 GNU 版本

  7. 【HDU 4602】Partition

    题意 给你一个数n,把它写成几个正整数相加的形式,即把n拆开成若干段,把所有可能的式子里正整数 k 出现的次数取模是多少. 分析 特判 k>=n 的情况. k<n时:问题相当于n个点排一行 ...

  8. POJ3233 Matrix Power Series

    Description Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + … + Ak. ...

  9. Openjudge 8782 乘积最大

    伤心,感冒了根本没精力肝题,只能做点小的 描述 今年是国际数学联盟确定的“2000——世界数学年”,又恰逢我国著名数学家华罗庚先生诞辰90周年.在华罗庚先生的家乡江苏金坛,组织了一场别开生面的数学智力 ...

  10. [Angularjs]国际化

    写在前面 在项目中,有用到国际化,跟着就了解了下使用angularjs实现的国际化,这里做一下记录. 系列文章 [Angularjs]ng-select和ng-options [Angularjs]n ...