keepcalculator

06 Numbers and Powers

Scan Network Devices for Open Ports: A Practical Guide

Card No. 06·33141 · Updated · Standard formula, shown below

The calculator on this card is switched off while it is checked. The formula is below, and the worked example shows how to do the sum by hand.

Yes, you can scan network devices for open ports, and doing so is a core part of network administration and security auditing. You enter a target IP address or hostname and a port range, and the scanner reports which ports are open, closed, or filtered. This article explains how port scanning works, what tools are commonly used, and how to interpret the results safely and effectively.

What Is a Port Scan?

A port scan is a method of probing a network device (like a server, router, or printer) to discover which network ports are accepting connections. Every IP-based service—web servers, email, file sharing—listens on a specific port number (e.g., HTTP on port 80, HTTPS on 443, SSH on 22). By sending packets to each port and observing the response, a scanner can build a map of the device’s exposed services.

Port scans are used by administrators to verify that only intended services are reachable, and by security professionals to identify potential attack surfaces. They are also used by attackers for reconnaissance, which is why scanning systems you do not own or lack permission to test may be illegal in many jurisdictions.

How Port Scanning Works

Most scanners use the TCP protocol because it has a clear connection handshake. The scanner sends a SYN packet to each port. The possible responses are:

  • SYN-ACK – the port is open and accepting connections.
  • RST – the port is closed (no service listening).
  • No response or ICMP unreachable – the port is filtered by a firewall.

Some scanners use a “half-open” or SYN scan that does not complete the handshake, making it less likely to be logged by the target. Other techniques include UDP scans (for services like DNS or SNMP), FIN scans (sending a FIN packet), and ACK scans (to map firewall rules). The most common tool is Nmap, which offers all these options and more.

Choosing a Port Scanner

For most users, Nmap is the de facto standard. It is free, open-source, and runs on Windows, macOS, and Linux. A basic command to scan a single host is:

nmap 192.168.1.1

This scans the 1000 most common ports. To scan a specific range, use -p:

nmap -p 1-1000 192.168.1.1

Other tools include Masscan (for very fast scans of large networks), Angry IP Scanner (a graphical tool for quick host discovery), and Zenmap (the graphical frontend for Nmap). For a single port check, you can use telnet host port or nc -zv host port (Netcat).

When choosing a tool, consider:

  • Speed – Masscan can scan the entire internet in minutes, but Nmap is more thorough.
  • Ease of use – GUI tools like Zenmap are friendlier for beginners.
  • Features – Nmap can detect OS, service versions, and run scripting engine scripts.

Interpreting the Results

Once a scan completes, you will see a list of ports with states. The three main states are:

  • Open – a service is listening. This is what you want to find, but also what attackers want.
  • Closed – no service is listening, but the port is reachable (no firewall block).
  • Filtered – a firewall or other network rule is blocking the probe, so the scanner cannot determine if the port is open.

For each open port, Nmap often shows the service name and version (e.g., “80/tcp open http Apache httpd 2.4.41”). This is valuable for patch management: if a service has known vulnerabilities, you can take action.

Common Problems and How to Avoid Them

Port scanning is not always straightforward. Here are typical issues:

  • Firewalls blocking your scan – If you get “filtered” for all ports, the target may be behind a firewall that drops packets. Try a different scan type (e.g., -sS for SYN) or scan from a different network.
  • Scanning the wrong IP – Double-check the target. A typo can lead you to scan an innocent third party.
  • False positives – Some services respond to any connection attempt (e.g., “port knocking” daemons). Verify open ports by connecting to them with a client.
  • Rate limiting – Slow down your scan if the target is dropping packets due to overload. Use --max-rate or -T2 (polite timing).

Safety, Legality, and Ethics

Scanning a network device without permission is illegal in many countries and violates most terms of service. Always get written authorization before scanning any system you do not own. For learning, use your own devices or a dedicated lab environment (e.g., virtual machines).

Even with permission, be cautious: aggressive scans can crash poorly configured devices or trigger intrusion detection systems. Use the least invasive scan that answers your question. For example, a simple connect scan (-sT) is less likely to cause issues than a UDP scan (-sU), which can take a long time and generate a lot of traffic.

Alternatives to Port Scanning

If you only need to know what services are running on a device you manage, there are simpler methods:

  • Check the device’s web interface – Most routers and printers have a status page listing open ports and services.
  • Use netstat – On the device itself, run netstat -tulpn (Linux) or netstat -an (Windows) to see listening ports.
  • Use a vulnerability scanner – Tools like OpenVAS or Nessus (free trial) combine port scanning with vulnerability checks, but are heavier and require more setup.

For a quick check of a single port, you can use online port checkers, but they only test your public IP from the internet, not internal devices.

Frequently Asked Questions

Is port scanning illegal?

It depends on jurisdiction and intent. Scanning a system you own or have permission to test is legal. Scanning someone else’s system without authorization is generally illegal, even if you don’t do anything with the information. Always get written permission first.

What is the difference between an open port and a filtered port?

An open port is actively accepting connections (a service is listening). A filtered port means a firewall or other network rule is dropping or rejecting the probe, so the scanner cannot tell if the port is open or closed. Filtered ports are common when scanning from the internet into a protected network.

Can a port scan crash a device?

Rarely, but it can happen. Some older or poorly written network stacks may crash under a flood of packets. Using a slow scan (-T2 or -T1) reduces the risk. Also, scanning a device that is critical to production may trigger alerts or temporary blocks.

How do I scan a range of IP addresses?

In Nmap, use CIDR notation or a hyphen: nmap 192.168.1.1-254 scans the entire /24 subnet. You can also use nmap 192.168.1.0/24. Be aware that scanning a large range takes longer and generates more traffic.

What ports should I scan first?

Start with the top 1000 most common ports (Nmap’s default). These include HTTP (80), HTTPS (443), SSH (22), FTP (21), SMTP (25), and RDP (3389). If you are looking for a specific service, scan that port directly.

Can I scan a device behind a NAT?

Yes, but only if the device has a public IP or you are on the same local network. If the device is behind a router with NAT, you can only scan its private IP from within the LAN. To scan from outside, you would need to set up port forwarding, which is a different process.

Related

Formula used
in ip | Target IP or hostname | - | 192.168.1.1 | 0
in p | Port range (e.g., 1-1000) | - | 1-1000 | 0
out open | Ports reported open | - | 0 | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →