shell脚本检测局域网内存活主机
<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脚本检测局域网内存活主机的更多相关文章
- 使用 Python 查看局域网内存活主机
1 安装 (如果误用了 pip insatll nmap的话,要先 pip uninstall nmap) pip install python-nmap Nmap 是一款用于网络发现和安全审计的网络 ...
- 多线程shell脚本检测主机存活
局域网中分了很多网段,而IP地址使用情况也未知,前期也没有规划和记录,当新的主机需要使用固定IP的时候,能否第一时间知道哪个IP空闲就显得很重要了,如果一个一个去ping的话太浪费时间. 这里分享一个 ...
- 生产环境Shell脚本Ping监控主机是否存活(多种方法)
在网上针对shell脚本ping监控主机是否存活的文档很多,但大多都是ping一次就决定了状态,误报率会很高,为了精确判断,ping三次不通再发告警,只要一次ping通则正常.于是,今天中午抽出点时间 ...
- arp命令(windows ),nmap查看局域网内所有主机IP和MAC
ARP命令详解 ARP是一个重要的TCP/IP协议,并且用于确定对应IP地址的网卡物理地址.实用arp命令,我们能够查看本地计算机或另一台计算机的ARP高速缓存中的当前内容.此外,使用arp命令,也可 ...
- 局域网内其他主机如何访问运行在宿主机的虚拟机中的Django项目(转)
局域网内其他主机如何访问运行在宿主机的虚拟机中的Django项目 1.在宿主机cmd中查看宿主机的ip(注意区分主机中虚拟机的ip) 我连的是无线,IP如下 2.在Django项目的mysit ...
- 访问局域网内其他主机的VMware虚拟机上的mysql数据库和redis缓存
上一篇写了访问局域网内其他主机的虚拟机上的项目 ,现在说说访问局域网内其他主机的虚拟机上的数据库和缓存 博主使用的linux是Ubuntu16.04: 一.安装数据库和缓存 这里连接的数据库和缓存以m ...
- Linux 下查看局域网内所有主机IP和MAC
linux环境下,执行namp对局域网扫描一遍,然后查看arp缓存表就可以知道局域内ip对应的mac.namp比较强大也可以直接扫描mac地址和端口,执行扫描之后就可以在/proc/net/arp查看 ...
- windows CMD命令查看局域网内所有主机名及IP
COLOR 0A CLS @ECHOOff Title查询局域网内在线电脑IP :send @ECHO off&setlocal enabledelayedexpansion ECHO 正在获 ...
- linux shell脚本检测硬盘磁盘空间 邮件报警
使用 http://www.weiruoyu.cn/?p=368 shell脚本监控硬盘空间剩余空间 邮件报警 1.先观察一下磁盘,和如何使用脚本 [root@localhost ~]# df -h ...
随机推荐
- 安装xampp二三事
1.chrome 找不到页面时会自动跳转到hao123 安装完chrome后,想测试下localhost,结果找不到页面,当然正常的显示是“该页面无法显示”才对,可恨啊,总是直接转到hao123页面上 ...
- MVC2 Area实现网站多级目录
Areas是ASP.NET Mvc 2.0版本中引入的众多新特性之一,它可以帮你把一个较大型的Web项目分成若干组成部分,即Area.实现Area的功能可以有两个组织形式: 在1个ASP.NET Mv ...
- iOS运行时 -- Runtime(摘抄自网络)
运行时(iOS) 一.什么是运行时(Runtime)? 运行时是苹果提供的纯C语言的开发库(运行时是一种非常牛逼.开发中经常用到的底层技术) 二.运行时的作用? 能获得某个类的所有成员变量 能获得某个 ...
- JS建造者模式
function getBeerById( id, callback){ _request('GET','URL'+id,function(res){ callback(res.responseTex ...
- Android intent传递list或对象
方法一: 如果单纯的传递List<String> 或者List<Integer>的话 就可以直接使用 Java代码 intent.putStringArrayListExtra ...
- return view详解
1.return View(); 返回值 类型:System.Web.Mvc.ViewResult将视图呈现给响应的 View() 结果. 注释 View() 类的此方法重载将返回一个具有空 View ...
- BZOJ2120 数颜色
Description 墨墨购买了一套N支彩色画笔(其中有些颜色可能相同),摆成 一排,你需要回答墨墨的提问.墨墨会像你发布如下指令: 1. Q L R代表询问你从第L支画笔到第R支画笔中共有几种不同 ...
- TypeError: 'module' object is not callable cp fromhttp://blog.csdn.net/huang9012/article/details/17417133
程序代码 class Person: #constructor def __init__(self,name,sex): self.Name = name ...
- POJ3233Matrix Power Series(十大矩阵问题之三 + 二分+矩阵快速幂)
http://poj.org/problem?id=3233 Matrix Power Series Time Limit: 3000MS Memory Limit: 131072K Total ...
- hashcode与字符串
问题1. 不同的字符串可能会有相同的HashCode吗? hashcode是用来判断两个字符串是否相等的依据,不同的字符串不可能有相同的hashcode,但不同的hashCode经过与长度的取余,就很 ...