1. 使用 nmap命令:

$ sudo nmap -sP 192.168.1.0/24
[sudo] password for charles: 

Starting Nmap 6.40 ( http://nmap.org ) at 2015-01-29 22:04 CST
Nmap scan report for promote.cache-dns.local (192.168.1.1)
Host is up (0.066s latency).
MAC Address: A8:57:4E:A7:53:F8 (Unknown)
Nmap scan report for promote.cache-dns.local (192.168.1.100)
Host is up (0.91s latency).
MAC Address: 90:4C:E5:C6:92:71 (Hon Hai Precision Ind. Co.)
Nmap scan report for promote.cache-dns.local (192.168.1.111)
Host is up (0.94s latency).
MAC Address: 84:38:38:47:34:97 (Unknown)
Nmap scan report for promote.cache-dns.local (192.168.1.112)
Host is up (0.91s latency).
MAC Address: 00:26:C6:50:BB:CC (Intel Corporate)
Nmap scan report for promote.cache-dns.local (192.168.1.114)
Host is up (0.91s latency).
MAC Address: D4:97:0B:50:63:79 (Unknown)
Nmap scan report for promote.cache-dns.local (192.168.1.122)
Host is up (0.91s latency).
MAC Address: 00:25:D3:FC:A1:F1 (AzureWave Technologies)
Nmap scan report for promote.cache-dns.local (192.168.1.113)
Host is up.
Nmap done: 256 IP addresses (7 hosts up) scanned in 15.85 seconds

2。使用shell 脚本:

$ cat ip_disc.sh 
#!/bin/bash
for i in `seq 1 254`
do
    {
        ping -c5 192.168.1.$i &>/dev/null && echo "192.168.1.$i is alive"
    }&
done
wait

e$ ./ip_disc.sh 
192.168.1.113 is alive
192.168.1.111 is alive
192.168.1.1 is alive
192.168.1.114 is alive
192.168.1.110 is alive
192.168.1.100 is alive
192.168.1.105 is alive
192.168.1.122 is alive


Logo

更多推荐