Netstat vs nmap to find IPs in a local network

netstatnmaprouterouting

I'm in a local network : IPv4 shared address space (100.x.x.x). Connected to a wifi hotspot. Ip ranges : 100.76.164.0/23

When I run :

  • nmap 100.76.164.0/23 : It says all the hosts are down
  • netstat -rn : it gives me a list of about 25 local ips (100.76.164.23, 100.76.164.27, etc)

Why can netstat -rn give me the IPs and not nmap?
What's the difference between routing table and the nmap scans?

Best Answer

It really depends on what you are trying to do. Nmap is a tool that is mostly used to scan some specific ports. Netstat is mostly used to scan port mappings on your local machine. Also note, that Netstat was deprecated a long time ago, the replacement for it is "ss" tool. If you are just trying to scan your network, and ICMP traffic is permitted in your network, then I would use something more suitable for your purpose. Fping is a tool that can ping all hosts in the specified network and give you some stats in the end.

e.g. fping -gs -r 0 100.76.164.0/23 Where: -s stands for statiscitcs in the end of the report -g generate ips bases on network/mask -r 0 (retry) only one ping retry per host

Please let me know if you need anything else.