I didn't get what ports does Nmap scan. Does Nmap start from zero or one when scan subnet or all the ports?

  • 0/24 is it 0-255 or is it 1-255
  • -p is it 0-65535 or is it 1-65535

Connecting to port 0 is not possible, see


It is a special port allowing programs to obtain random port for outgoing connection, and should not be used for incoming connections

Therefore, use -p 1-65535 for nmap, especially if you are using TCP or UDP scans

As for /24 notation that is entirely different thing: it is called CIDR notation and used to match range of hosts on network. For instance, will specify all addresses between to

  • but i can scan all ports in nmap using the command -p 0-65535 – Ven Ven Jan 2 '20 at 19:55
  • so /24 start with zero not one ? – Ven Ven Jan 2 '20 at 20:06
  • @VenVen You can use -p 0-65535. But trying to scan port 0 is pointless - it's never open to outside world, only to programs on the host itself. – Sergiy Kolodyazhnyy Jan 3 '20 at 6:48
  • As for /24, yes, address range starts at 0 and goes to 255. That's 256 hosts in total theoretically. But remember that in practice is broadcast address for the whole network. Typically it's not used for a host and ping utility for example will throw an error, but it is perfectly valid address. On a different subnet other than /24, it could be a perfectly valid host. See also stackoverflow.com/a/14915309/3701431 and unix.stackexchange.com/a/407395/85039 – Sergiy Kolodyazhnyy Jan 3 '20 at 6:48

Nmap can scan all TCP UDP ports. You must to know subnetting and network knowledge. 0 port is not a standart port. For subnet if you use 24 subnetmask you will not scan address because 24 subnetmask have a useable range for hosts. 0.0 is out of subnet useable scope. You can learn from here: http://www.steves-internet-guide.com/subnetting-subnet-masks-explained/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.