在區域網路中,有時需要快速找出目前連線的裝置。Nmap 是一款強大的開源網路掃描工具,可用於主機發現、埠口掃描與安全檢查。
sudo yum install nmap sudo dnf install nmap sudo apt-get install nmap
先使用 ifconfig 或 ip addr show 查看本機網路與子網掩碼。

使用 ping 掃描模式,可快速列出網段中的活躍主機:
nmap -sn 10.42.0.0/24

-sn 表示不進行埠口掃描,只做主機發現。若要更詳細資訊,可查看 man nmap 或直接執行 nmap 查看說明。
這個方法簡單快速,適合日常網路盤點與故障排查。