Network Ports
A network port is a 16-bit number used by TCP or UDP to identify a specific application or service endpoint on a host.
Simple definition
A port number helps the operating system determine which application should receive network traffic.
For example:
192.168.1.10:443
means:
IP Address → 192.168.1.10 Port → 443
Port 443 is commonly associated with HTTPS.
1. Why Do We Need Ports?
Imagine one computer is running several network services:
Computer │ ┌───────────────┼────────────────┐ ↓ ↓ ↓ Web SSH DNS Port 443 Port 22 Port 53
The IP address identifies the host, but the port helps identify the service/application endpoint.
Without ports, the operating system would have difficulty determining which application should receive incoming transport traffic.
2. IP Address vs Port
This is extremely important.
IP Address ↓ Identifies the network destination/host interface Port ↓ Identifies the transport-layer application endpoint
Example:
192.168.1.10:443
Here:
192.168.1.10 → IP address 443 → port
Together they form an endpoint commonly called a socket address.
3. Port Belongs to the Transport Layer
Ports operate at:
OSI Layer 4 — Transport Layer
They are used by:
TCP UDP
So:
Application ↓ TCP / UDP ↓ Port Number ↓ IP
Example:
HTTPS ↓ TCP ↓ 443 ↓ IP
4. Port Number Range
TCP and UDP ports are 16-bit numbers.
Therefore the range is:
0 – 65535
They are commonly divided into three ranges:
| Range | Name | Typical Use |
|---|---|---|
0–1023 | Well-known ports | Common standard services |
1024–49151 | Registered ports | Registered applications/services |
49152–65535 | Dynamic/private ports | Often temporary client-side ports |
The exact allocation/use can vary, and modern applications don't always fit neatly into these traditional categories.
5. Well-Known Ports
Ports 0–1023 contain many well-known service assignments.
Some important examples:
| Port | Protocol/Service | Transport |
|---|---|---|
| 20 | FTP data | TCP |
| 21 | FTP control | TCP |
| 22 | SSH | TCP |
| 23 | Telnet | TCP |
| 25 | SMTP | TCP |
| 53 | DNS | UDP/TCP |
| 67 | DHCP Server | UDP |
| 68 | DHCP Client | UDP |
| 69 | TFTP | UDP |
| 80 | HTTP | TCP |
| 110 | POP3 | TCP |
| 123 | NTP | UDP |
| 143 | IMAP | TCP |
| 161 | SNMP | UDP |
| 162 | SNMP Trap | UDP |
| 389 | LDAP | TCP/UDP |
| 443 | HTTPS | TCP |
| 445 | SMB | TCP |
| 587 | SMTP Submission | TCP |
| 993 | IMAPS | TCP |
| 995 | POP3S | TCP |
These are common defaults, not absolute requirements. Services can be configured to use different ports.
6. TCP Port and UDP Port Are Different
This is very important.
TCP and UDP have separate port namespaces.
For example:
TCP 53
and
UDP 53
are not the same endpoint.
A machine could technically have:
TCP 53 → Service A UDP 53 → Service B
at the same time.
7. TCP Port
TCP provides a reliable transport service.
Example:
TCP 443
commonly represents HTTPS traffic.
A TCP connection uses endpoints such as:
Client Server 192.168.1.10:51520 ───────> 93.184.216.34:443
Here:
51520 → Client's temporary/source port 443 → Server's destination port
8. UDP Port
UDP also uses port numbers, but it does not establish a TCP-style connection.
Example:
UDP 53
is commonly used for DNS queries.
Client 192.168.1.10:52000 │ │ UDP ↓ DNS Server 8.8.8.8:53
9. Source Port and Destination Port
A transport-layer packet generally contains:
Source Port Destination Port
Example:
Source IP: 192.168.1.10 Source Port: 52000 Destination IP: 93.184.216.34 Destination Port: 443
So communication can be represented as:
192.168.1.10:52000 │ ↓ 93.184.216.34:443
The server normally listens on a known/service port, while the client commonly uses a temporary source port.
10. What Is a Listening Port?
A listening port is a port on which a service is waiting for incoming connections or traffic.
For example:
Server │ ├── TCP 22 → SSH ├── TCP 80 → HTTP └── TCP 443 → HTTPS
If an application is listening on TCP port 22:
Client ↓ TCP 22 ↓ SSH Service
The operating system delivers the traffic to the appropriate process.
11. Open Port
When someone says:
"Port 443 is open."
they generally mean that a network scan or connection attempt indicates that something is accepting or responding on that port.
For example:
443/tcp → open
This does not automatically mean:
443 → vulnerable
An open port simply indicates network accessibility to a listening service under the conditions of the scan.
12. Closed Port
A closed TCP port usually means:
- The host is reachable
- Nothing is listening on that TCP port
For example:
80/tcp → closed
The exact response depends on firewall and network behavior.
13. Filtered Port
A port may appear filtered when a firewall or other network control prevents the scanner from determining whether the port is open.
Example:
22/tcp → filtered
Possible reasons:
Scanner ↓ Firewall ✕ Server
The firewall may silently drop packets or otherwise interfere with the probe.
14. Open vs Closed vs Filtered
| State | Meaning |
|---|---|
| Open | A service appears to be listening/responding |
| Closed | Host is reachable, but no service is listening on that port |
| Filtered | Filtering prevents determining the port state clearly |
This terminology is especially important when using tools such as Nmap on systems you are authorized to test.
15. Common Ports You Should Memorize
For networking and cybersecurity, these are especially useful:
20/21 → FTP 22 → SSH 23 → Telnet 25 → SMTP 53 → DNS 67/68 → DHCP 69 → TFTP 80 → HTTP 110 → POP3 123 → NTP 143 → IMAP 161 → SNMP 389 → LDAP 443 → HTTPS 445 → SMB 587 → SMTP Submission 993 → IMAPS 995 → POP3S
A compact memory list:
22 → SSH 53 → DNS 80 → HTTP 443 → HTTPS
These four are particularly important.
16. Port 22 — SSH
TCP 22
Used by:
Secure Shell
Example:
ssh user@server
Your Computer │ │ TCP 22 ↓ SSH Server
17. Port 80 — HTTP
TCP 80
Used by HTTP.
Browser │ │ TCP 80 ↓ Web Server
Example:
http://example.com
HTTP itself does not provide encryption.
18. Port 443 — HTTPS
TCP 443
Traditionally, HTTPS commonly uses TCP 443.
Browser │ │ HTTPS │ TCP 443 ↓ Web Server
Modern HTTP can also use HTTP/3 over QUIC, which commonly uses:
UDP 443
So:
TCP 443 → Common HTTPS/HTTP traffic UDP 443 → Common HTTP/3/QUIC traffic
This is an important modern networking detail.
19. Port 53 — DNS
DNS commonly uses:
UDP 53
and can also use:
TCP 53
Example:
Client │ │ UDP 53 ↓ DNS Server
Modern encrypted DNS technologies use other transport mechanisms as well, such as:
DNS over TLS → TCP 853 DNS over HTTPS → HTTPS, commonly TCP/443
20. Ephemeral Ports
When your computer acts as a client, it commonly chooses a temporary source port.
For example:
Client: 192.168.1.10:52741 Server: 93.184.216.34:443
Here:
52741 → Ephemeral/client-side port 443 → Server/service port
The operating system selects an available temporary port according to its networking implementation.
21. Why Does a Client Need a Source Port?
Suppose you open three websites simultaneously:
Browser Tab 1 Browser Tab 2 Browser Tab 3
All may communicate with port 443 on remote servers, but your computer needs to distinguish the different communication flows.
For example:
192.168.1.10:51001 → Server A:443 192.168.1.10:51002 → Server B:443 192.168.1.10:51003 → Server C:443
The transport-layer information helps the operating system associate incoming traffic with the correct connection/socket.
22. Socket
A socket is an endpoint used for network communication.
A simplified TCP connection is identified by:
Source IP Source Port Destination IP Destination Port Protocol
For example:
TCP 192.168.1.10:51001 ↓ 142.250.x.x:443
A common term is the 5-tuple:
Protocol Source IP Source Port Destination IP Destination Port
This uniquely identifies a flow in many networking contexts.
23. Port Is Not the Same as a Service
A port number does not guarantee what application is actually running there.
For example:
TCP 8080
is often used for web applications, but it could be used for another service.
Similarly:
TCP 22
is commonly associated with SSH, but an administrator could configure another application to listen there.
Therefore:
Port number suggests a service; it does not prove the service.
24. Port Scanning
A port scan checks how a host responds to probes sent to selected ports.
For example, with an authorized lab system:
nmap 192.168.1.10
You might see:
PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 443/tcp open https
This tells you that those ports appear accessible and that Nmap's service identification associates them with those services.
For cybersecurity, port scanning is useful for:
- Asset discovery
- Attack-surface inventory
- Network troubleshooting
- Security auditing
- Authorized penetration testing
25. Port Scanning Does Not Mean Hacking
For example:
443/tcp open
does not mean:
Server is vulnerable
It only means that the port appears open.
A proper security assessment then considers:
Open port ↓ Service identification ↓ Version/configuration ↓ Security assessment
Only perform scanning and testing on systems you own or are explicitly authorized to assess.
26. Port Numbers and Firewalls
Firewalls can control traffic based on ports.
Example:
Internet │ ↓ Firewall │ ├── TCP 443 → Allow ├── TCP 22 → Allow from admin network └── TCP 23 → Block
This can reduce unnecessary exposure.
However, allowing a port does not make the service secure. The service itself must also be properly configured and patched.
27. Port Forwarding
Port forwarding allows traffic arriving at a router/firewall to be forwarded to an internal device.
Example:
Internet │ ↓ Public IP:443 │ Router │ ↓ 192.168.1.100:443
For example:
Public: 203.0.113.50:443 ↓ NAT/Port Forward Internal: 192.168.1.100:443
This can expose an internal service to the Internet, so it must be configured carefully.
28. Port Numbers and Network Security
Every exposed service increases the potential attack surface.
Example:
Server ├── 22/tcp SSH ├── 80/tcp HTTP ├── 443/tcp HTTPS └── 3306/tcp Database
A security administrator may ask:
- Is this service required?
- Is it exposed to the Internet?
- Is authentication secure?
- Is the software patched?
- Can access be restricted?
- Is encryption enabled?
A good principle is:
Expose only services that are actually required, and restrict access wherever possible.
29. Some Important Database Ports
For cybersecurity and system administration, you may also encounter:
| Port | Common Service |
|---|---|
| 1433 | Microsoft SQL Server |
| 1521 | Oracle Database |
| 3306 | MySQL/MariaDB |
| 5432 | PostgreSQL |
| 6379 | Redis |
| 27017 | MongoDB |
These are default/common ports, not guarantees of what is actually running.
30. Some Important Application/Infrastructure Ports
| Port | Common Service |
|---|---|
| 3000 | Common development web apps |
| 5000 | Common development web apps |
| 8080 | Common HTTP alternate |
| 8443 | Common HTTPS alternate |
| 5900 | VNC |
| 3389 | RDP |
Again, a port number alone does not prove the service.
31. Port vs IP vs MAC
This is the most important revision:
MAC Address ↓ Local network/link ↓ AA:BB:CC:DD:EE:FF IP Address ↓ Logical network destination ↓ 192.168.1.10 Port ↓ Application endpoint ↓ 443
Together:
AA:BB:CC:DD:EE:FF ↓ 192.168.1.10 ↓ TCP 443 ↓ HTTPS service
32. Complete Example
Suppose your laptop opens:
https://example.com
A simplified connection might look like:
Your Laptop IP: 192.168.1.10 │ │ Source Port: 52000 ↓ Internet │ │ Destination Port: 443 ↓ Web Server
The stack:
HTTPS ↓ TCP ↓ Port 443 ↓ IP ↓ Ethernet/Wi-Fi
The server receives traffic for its HTTPS endpoint and passes it to the appropriate application.
33. Important Port States
For basic network scanning:
OPEN ↓ A service appears to be listening CLOSED ↓ Host reachable, but no service listening FILTERED ↓ Filtering prevents a clear determination
These states are observations from a particular scan, not permanent properties of a machine.
34. Important Points to Remember
Port range
0 – 65535
Transport layer
TCP / UDP
Common ports
21 → FTP 22 → SSH 23 → Telnet 25 → SMTP 53 → DNS 80 → HTTP 110 → POP3 143 → IMAP 443 → HTTPS 445 → SMB
Modern HTTPS
TCP 443 → Common HTTPS UDP 443 → QUIC / HTTP/3
Key relationship
MAC → Local link IP → Network Port → Application endpoint
Quick Revision Diagram
NETWORK COMMUNICATION │ ┌─────────────┴─────────────┐ │ │ IP Address Port │ │ 192.168.1.10 443 │ │ Layer 3 Layer 4 │ │ └──────────┬────────────────┘ ↓ TCP / UDP ↓ Application ↓ HTTP / HTTPS / SSH
One-line exam answer:
A network port is a 16-bit transport-layer number, ranging from 0 to 65535, used by TCP or UDP to identify a specific application or service endpoint on a host.