我在一个局域网中,有3台Ubuntu、2台Kubuntu、2台Windows XP和2台Windows 7。有哪些命令或工具可以查看连接到局域网的计算机,并显示计算机的名称和IP地址。类似于像Angry IP这样的工具,可以显示局域网中的所有计算机。
请注意,我不知道连接到局域网的计算机的IP地址或名称。因此,该工具或命令应该能够自动查找它们。
请注意,我不知道连接到局域网的计算机的IP地址或名称。因此,该工具或命令应该能够自动查找它们。
Arp-scan 对我也很有效...
如果使用 Wi-Fi:
sudo arp-scan -l --interface=wlan0
sudo arp-scan -l --interface=eth0
sudo apt-get install arp-scan
wlan0
。 - mLstudent33sudo lshw -c network
命令查看所有的网络接口。 - Chadwlp2s0
的东西。运行 iwconfig
命令,它应该是列表中的最后一个。 - mchidfor ip in $(seq 1 254); do ping -c 1 192.168.1.$ip>/dev/null;
[ $? -eq 0 ] && echo "192.168.1.$ip UP" || : ;
done
$ sudo arp-scan --localnet
nmap -sP 192.168.0.1/24
更多信息请参考:https://www.cyberciti.biz/networking/nmap-command-examples-tutorials/
这是一个非常好用的工具。如果你使用Debian,你可以使用以下命令安装nmap
:
sudo apt-get install nmap
如果你使用Arch,你可以使用以下命令安装nmap
:
sudo pacman -S nmap
yum install nmap
- Rurajdnf install nmap
将安装 nmap。 - BendaThierry.commacvendor
功能? - Jeff WardAddress HWtype HWaddress Flags Mask Iface
iPhone-von-me.fritz.box ether 12:55:05:30:3c:df C wlp3s0
android-abcdefghijklmno ether 11:66:3f:71:04:d6 C wlp3s0
fritz.box ether 00:11:3f:46:37:c2 C wlp3s0
Blupiblu.fritz.box ether 71:88:cc:bb:dc:a6 C wlp3s0
ip neigh
和hosts
。无需nmap / sudo。
在此基础上,您可以构建一个Python脚本:
#!/usr/bin/env python
"""List all hosts with their IP adress of the current network."""
import os
out = os.popen('ip neigh').read().splitlines()
for i, line in enumerate(out, start=1):
ip = line.split(' ')[0]
h = os.popen('host {}'.format(ip)).read()
hostname = h.split(' ')[-1]
print("{:>3}: {} ({})".format(i, hostname.strip(), ip))
通过下载
wget https://gist.githubusercontent.com/MartinThoma/699ae445b8a08b5afd16f7d6f5e5d0f8/raw/577fc32b57a7f9e66fdc9be60e7e498bbec7951a/neighbors.py
1: _gateway. (207.23.10.xx4)
其中xx代表数字。 - mLstudent33ping -b 192.168.0
ping -b 192.168.0.255