In networking, an IP address gets data to the correct computer, but a Network Port ensures the data reaches the correct application running on that computer. A port is a logical endpoint represented by a number between 1 and 65,535.
Think of an IP address as a large apartment building. When a package arrives at the building, the delivery driver needs the apartment number (the Port) to know which specific tenant should receive the package. Without ports, a server couldn't simultaneously host a website, an email server, and a file share on the same IP address.
TCP vs UDP Ports
Ports are utilized by Transport Layer protocols, primarily TCP and UDP. Port 53 using TCP is technically entirely different from Port 53 using UDP, though by convention, services often reserve both. TCP is used for reliable connections (like loading a webpage), while UDP is used for fast, connectionless data (like streaming video or DNS queries).
Well-Known Ports Reference Table
Ports 0 through 1023 are classified as "Well-Known Ports" and are standardized by IANA for specific foundational services. Every IT professional should memorize these common ports:
| Port | Protocol | Service | Description |
|---|---|---|---|
| 20 / 21 | TCP | FTP | File Transfer Protocol. Port 21 is for control, 20 for data transfer. |
| 22 | TCP | SSH | Secure Shell. Used for secure remote command-line access. |
| 23 | TCP | Telnet | Unencrypted remote access. Highly insecure; mostly obsolete. |
| 25 | TCP | SMTP | Simple Mail Transfer Protocol. Used for sending emails between servers. |
| 53 | UDP / TCP | DNS | Domain Name System. UDP for standard queries, TCP for zone transfers. |
| 67 / 68 | UDP | DHCP | Dynamic Host Configuration. 67 is for the server, 68 for the client. |
| 80 | TCP | HTTP | Unencrypted web traffic. |
| 110 | TCP | POP3 | Email retrieval protocol (downloads and deletes from server). |
| 123 | UDP | NTP | Network Time Protocol. Used for clock synchronization across networks. |
| 143 | TCP | IMAP | Email retrieval protocol (syncs folders with server). |
| 161 / 162 | UDP | SNMP | Simple Network Management Protocol. 161 for polling, 162 for traps. |
| 389 | TCP | LDAP | Lightweight Directory Access Protocol. Used for Active Directory queries. |
| 443 | TCP | HTTPS | Encrypted web traffic (TLS/SSL). |
| 445 | TCP | SMB | Server Message Block. Used for Windows file sharing. |
| 514 | UDP | Syslog | Used for sending network logs to a central server. |
| 636 | TCP | LDAPS | Secure LDAP (Encrypted Directory Access). |
| 3389 | TCP / UDP | RDP | Remote Desktop Protocol. Used for Windows remote GUI access. |
Listening Ports vs Ephemeral Source Ports
It is a common misconception that all communication on the web happens on Port 443.
Servers use Listening Ports. A web server sits quietly, listening on Port 443 for incoming connections.
Clients (your web browser) use Ephemeral Source Ports. When your browser connects to a web server, your computer generates a temporary, random high-number port (e.g., Port 54321) as its return address. The connection is established between Your_IP:54321 and Server_IP:443. Once you close the tab, your computer releases Port 54321 for future use.
Commands to Verify and Test Ports
1. Checking Local Listening Ports (What is running on my machine?)
If you start a web server but it fails to load, you need to check if the application successfully bound to Port 80 or 443.
Windows (Command Prompt):
TCP 0.0.0.0:443 0.0.0.0:0 LISTENING 1452
Linux:
2. Testing Remote Port Connectivity (Is the firewall blocking it?)
If you cannot access a remote server, pinging it is not enough. Ping only tests Layer 3. You must test the specific TCP port.
Windows (PowerShell):
ComputerName : 192.168.1.50
RemoteAddress : 192.168.1.50
RemotePort : 3389
TcpTestSucceeded : True
Linux / macOS (using netcat):
Connection to 192.168.1.50 22 port [tcp/ssh] succeeded!
Common Troubleshooting Errors
When testing a TCP connection with tools like netcat, curl, or your web browser, the error message tells you exactly where the failure occurred:
1. Connection Refused
The packet reached the destination server, but the server actively rejected it. This usually means the server is online, but the service (like Apache or SSH) is crashed, stopped, or listening on the wrong port. It can also mean a host-based firewall actively rejected the packet.
2. Connection Timeout
The packet was sent, but no response was ever received. The packet vanished into a black hole. This almost always indicates that a Stateful Firewall is silently dropping the traffic along the route.
Quick Summary
- Ports identify the specific application receiving the data.
- Servers listen on well-known standard ports (e.g., 443 for HTTPS).
- Clients use temporary ephemeral source ports to receive the replies.
netstatandsscheck local listening ports.- PowerShell's
Test-NetConnectionand Linux'snctest remote port reachability through firewalls.