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 ...
随机推荐
- JS面向对象概述
这部分内容还是比较难理解的,像借用构造函数这种方法,实际工作中还是很常见的,不过对于后面的寄生理解还有点困难,只能慢慢学习了. 思维导图
- z-index详解
来源于:http://www.cnblogs.com/ForEvErNoME/p/3373641.html 概念 z-index 属性设置元素的堆叠顺序.拥有更高堆叠顺序的元素总是会处于堆叠顺序较低的 ...
- ovs-agent流程
1. 代码流程分析 neutron/plugins/openvswitch/agent/ovs_neutron_agent.py:main() plugin = OVSNeutronAgent(**a ...
- Oracle单组函数
--Upper -------把字符转换成大写 SELECT Upper ('abcde') FROM dual ; --Lower ----- 把字符转换成小写 SELE ...
- 【poj1962】 Corporative Network
http://poj.org/problem?id=1962 (题目链接) 时隔多年又一次写带权并查集. 题意 n个节点,若干次询问,I x y表示从x连一条边到y,权值为|x-y|%1000:E x ...
- BZOJ4590 自动刷题机
Description 曾经发明了信号增幅仪的发明家SHTSC又公开了他的新发明:自动刷题机--一种可以自动AC题目的神秘装置.自动 刷题机刷题的方式非常简单:首先会瞬间得出题目的正确做法,然后开始写 ...
- 洛谷P2925 [USACO08DEC]干草出售Hay For Sale
题目描述 Farmer John suffered a terrible loss when giant Australian cockroaches ate the entirety of his ...
- 循序渐进Linux 3:Linux下软件安装与管理
一.源码安装 ./configuremakemake install 二.RPM包 1. 安装软件包 rpm -i [辅助选项] file1.rpm file2.rpm主选项 -i: install, ...
- 操作haproxy配置文件教师版
作用: 可查,可增,可删,可修改 #_*_coding:utf-8_*_ import os def file_handle(filename,backend_data,record_list=Non ...
- DedeCMS 5.7 后门漏洞
简要描述: DedeCMS V5.7 SP1正式版 UTF-8 GBK版本疑似被植入一句话后门 前几日下载并不存在此代码 详细说明: shopcar.class.php被植入一句话@eval(file ...