brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: nmap -sL lists target addresses and their names without scanning

Nmap
~/tips/tip-nmap-list-scan-reverse-names

nmap -sL 192.0.2.0/28

Preview what a target range expands to and which names reverse DNS gives.

Before I point a scanner at a range, I like to see which addresses that range contains. The list scan does exactly that and sends nothing to the targets.

nmap -sL 192.0.2.0/28

It prints one line per address. Where reverse DNS knows a name, you get the name next to the address, which turns the run into a quick audit of your PTR records. Old hostnames for machines that were retired long ago tend to stand out.

It’s also a safety check for odd target syntax. Ranges such as this one are valid, and it’s easy to misread how far they reach:

nmap -sL 192.0.2.10-20,200

If the list contains something you didn’t mean to include, you found out for free.

Don’t mistake it for host discovery. A name in the list only means DNS has a record, so a machine can be listed while it is switched off, and a running one can appear with no name at all. The reverse lookups do go to your DNS server (add -n if you want the addresses without any lookups). To find out which hosts are up you need a ping scan, and that one does touch them.

Further reading: Nmap host discovery

More Nmap tips nmap --packet-trace -p 22,80 192.0.2.10 nmap -p 22,80,443 -oG scan.gnmap 192.0.2.0/24 nmap -sV 192.0.2.10 sudo nmap -sU -p 53,67,123,161 192.0.2.10 nmap -oX before.xml 192.0.2.10 All Nmap tips (12) All topics

Link