I can ping but ports are closed

icmpping

I am using nmap to scan open ports of a device (Android smartphone), and nmap returns me that all 1000 scanned ports are closed. Right.

But in the same time I can ping the device. I thought that pinging a device would send a ICMP "echo" message to it, which is using port 7 if I am good.

So, two questions :
Why does nmap say that all ports are closed (meaning that the remote computer rejected my connection attempt with a RST packet Filtered), if I can ping on port 7 ?
Why does nmap only scan 1000 ports and not 65K ?

Thank you

Best Answer

TCP port 7 ('echo') and ICMP echo request messages are two very different things. Ping uses ICMP echo messages, which (since it's ICMP) do not use TCP. So this has nothing to do with TCP ports being open or closed, you can't "ping" TCP ports using the ping utility.

My guess would be that nmap scans 1000 ports by default because those are most of the well known ports, and to reduce runtime. You can always specify all ports using -p 0-65535.