nmap:nmap不仅可以扫描ip还可以扫描端口。

nmap -sP -PI -PT 192.168.1.0/24

检查是否可以ssh的IP:

#!/bin/bash

export HOST_IP=$1

ssh -o PreferredAuthentications=publickey -o StrictHostKeyChecking=no -o ConnectTimeout=1 $HOST_IP 'date'
if [ $? -ne 0 ]; then
        echo 'Unable to log in without password'
	echo $HOST_IP >> ssh_notok_ips
else
	echo $HOST_IP >> ssh_ok_ips
fi

fping:扫描IP是否可用

fping -g 192.168.199.0/24