Secure Network Best Practices Library · Firewalls and VPN
TCP and UDP ports reference guide: common network ports and how to secure them
A plain-language reference to the TCP and UDP ports that business networks use every day: remote access, web, mail, file sharing, name and address services, VPN, voice and databases. For each one it says what the port does and where it belongs: open to the internet, inside only, or nowhere.
Prefer to have it done for you? IT Perfection provides network security hardening and managed firewall services for companies in Irvine, Orange County and Los Angeles County.
Written by Ali Hassani, CISSP and C|CISO · 25+ years designing, securing and supporting business networks · Updated November 2026



Secure Network Best Practices Library › Firewalls and VPN › TCP and UDP ports reference
The basics
What a port is and why it matters for security
An IP address gets traffic to the right device. The port number gets it to the right program on that device. A web server listens on port 443, a file server on 445, a remote desktop host on 3389. When nothing is listening on a port, connections to it are refused.
TCP sets up a connection and confirms delivery; it is used for web, email, file sharing and remote access. UDP sends without setting up a connection; it is used where speed matters more than confirmation, such as name lookups, voice and video.
Security work on a network is, to a large extent, deciding which ports on which devices can be reached from where. Every port that answers is a service someone has to keep patched and configured. The fewer that answer, and the fewer places they answer to, the smaller the job.
First rule
Ports that should never face the internet
| Port | Service | Why | Use instead |
|---|---|---|---|
| TCP 3389 | Remote Desktop (RDP) | Constant password guessing; a direct path to a computer | VPN with multi-factor sign-in |
| TCP 445, 139 | Windows file sharing (SMB, NetBIOS) | Designed for local networks | VPN, or a cloud file service |
| TCP 23 | Telnet | Everything in clear text, including passwords | SSH, inside only |
| TCP 21 | FTP | Clear-text sign-in | SFTP or HTTPS upload, limited by source |
| TCP 1433, 3306, 5432, 1521 | Databases (SQL Server, MySQL, PostgreSQL, Oracle) | Data and credentials directly exposed | VPN or private application connection |
| TCP 5900 | VNC | Remote control with weak protection | VPN |
| UDP 161 | SNMP | Reveals device details; old versions have no real protection | Inside only, version 3 |
| TCP 135, UDP 137-138 | Windows RPC and NetBIOS | Local network services | Never forwarded |
| TCP 80, 443, 8080, 8443 on device admin pages | Firewall, switch, printer, camera and recorder management | Whoever signs in controls the device | Management network and VPN |
Moving one of these to a different port number does not protect it. Scanners test all ports. See NAT and port forwarding security and management interface lockdown.
Reference
Common TCP and UDP ports, what they do, and where they belong
Remote access and administration
| Port | Protocol | Service | Where it belongs |
|---|---|---|---|
| 22 | TCP | SSH: encrypted command line and file transfer (SFTP) | Inside, from the admin range; internet only with a source limit |
| 23 | TCP | Telnet | Nowhere |
| 3389 | TCP, UDP | Remote Desktop | Inside; from outside only through the VPN |
| 5985, 5986 | TCP | Windows remote management | Inside, admin range |
| 161, 162 | UDP | SNMP queries and traps | Inside, monitoring server only |
Web and file transfer
| Port | Protocol | Service | Where it belongs |
|---|---|---|---|
| 80 | TCP | HTTP: unencrypted web | Outbound; inbound only to redirect to 443 |
| 443 | TCP, UDP | HTTPS: encrypted web; UDP for HTTP/3 | Outbound; inbound to published web services |
| 21 | TCP | FTP control | Avoid; replace with SFTP |
| 445 | TCP | SMB: Windows file and printer sharing | Inside, staff to file servers |
| 2049 | TCP, UDP | NFS file sharing | Inside, servers only |
| Port | Protocol | Service | Where it belongs |
|---|---|---|---|
| 25 | TCP | SMTP between mail servers | To and from your mail service only |
| 587 | TCP | Mail submission from clients, with sign-in | Outbound to your mail provider |
| 993 | TCP | IMAP over TLS | Outbound to your mail provider |
| 995 | TCP | POP3 over TLS | Outbound to your mail provider |
| 110, 143 | TCP | POP3 and IMAP without encryption | Avoid |
Names, addresses and time
| Port | Protocol | Service | Where it belongs |
|---|---|---|---|
| 53 | UDP, TCP | DNS: name lookups | Clients to your resolvers; resolvers outbound |
| 67, 68 | UDP | DHCP: address assignment | Inside each VLAN, or relayed |
| 123 | UDP | NTP: time | Inside to your time source; that source outbound |
| 88 | TCP, UDP | Kerberos: Windows sign-in | Inside, to domain controllers |
| 389, 636 | TCP | LDAP and LDAP over TLS: directory | Inside, to domain controllers; prefer 636 |
| 1812, 1813 | UDP | RADIUS: authentication and accounting | Network devices to the RADIUS server |
VPN and voice
| Port | Protocol | Service | Where it belongs |
|---|---|---|---|
| 500, 4500 | UDP | IPsec key exchange and NAT traversal | Internet to the VPN gateway, known peers where possible |
| 1194 | UDP | OpenVPN | Internet to the VPN gateway |
| 51820 | UDP | WireGuard, common default | Internet to the VPN gateway |
| 5060, 5061 | UDP, TCP | SIP call signalling; 5061 is encrypted | To and from your phone provider only |
| 10000-20000 (varies) | UDP | RTP voice audio | As your phone provider specifies |
Databases and printing
| Port | Protocol | Service | Where it belongs |
|---|---|---|---|
| 1433 | TCP | Microsoft SQL Server | Inside, application servers only |
| 3306 | TCP | MySQL and MariaDB | Inside, application servers only |
| 5432 | TCP | PostgreSQL | Inside, application servers only |
| 9100 | TCP | Direct printing | Inside, staff to printers |
| 631 | TCP | Internet Printing Protocol | Inside, staff to printers |
| 514 | UDP | Syslog | Inside, devices to the log server |
Port ranges for voice audio and for some applications differ by vendor; use the figures your provider publishes. The authoritative list of assigned port numbers is the IANA service name and port number registry.
Port ranges, and the port a connection comes from
| Range | Name | Used for |
|---|---|---|
| 0 to 1023 | Well-known ports | Standard services such as web, mail, DNS and SSH |
| 1024 to 49151 | Registered ports | Applications registered with IANA, such as SQL Server on 1433 and Remote Desktop on 3389 |
| 49152 to 65535 | Dynamic or ephemeral ports | Chosen temporarily by the computer that starts a connection |
Every connection has two ports. The destination port identifies the service, for example 443. The source port is picked at random from the dynamic range by the computer that starts the connection, and exists only for that conversation. This is why firewall rules are written against the destination port and leave the source port as any.
Business firewalls are stateful. When a rule allows a connection out, the firewall remembers it and lets the replies back in automatically. You do not open inbound ports for staff to browse the web. Inbound rules are needed only for connections that start from outside, which is exactly why each one deserves scrutiny.
Open, closed and filtered
| State | What a scan sees | Meaning |
|---|---|---|
| Open | The port answers | A service is listening and reachable from where you scanned |
| Closed | The device refuses the connection | The device is reachable, but nothing listens on that port |
| Filtered | No answer at all | A firewall is dropping the traffic; this is the result you want for everything not deliberately published |
The result depends on where the scan is run from. A port can be open from the staff network, filtered from the guest network and filtered from the internet, all at once. A complete review looks from each of those places.
Outbound ports matter too
Most attention goes to inbound ports, but what may leave the network is also a control. Malware on a computer has to reach its operator, and data has to leave to be stolen. An outbound policy that allows web, mail to your provider, DNS only to your chosen resolvers and the specific ports your applications need, and blocks the rest, removes many of the easy routes. Outbound file sharing (445), remote desktop (3389), Telnet (23) and mail on port 25 from ordinary computers are common candidates to block; none of them has a normal business use toward the internet from a staff computer.
How to check
How to see which ports are open
# Which ports this computer is listening on, and which program owns each Get-NetTCPConnection -State Listen | Sort-Object LocalPort | Select-Object LocalAddress, LocalPort, OwningProcess # Is a port on another device reachable from here? Test-NetConnection 10.10.50.10 -Port 445
# Listening ports and the program behind each ss -tulpn # Linux lsof -iTCP -sTCP:LISTEN -n -P # macOS # Is a port reachable? nc -vz 10.10.50.10 445
# Scan your own public address with nmap, from a network outside the office # Only scan addresses you own or have written permission to test nmap -Pn -p- 203.0.113.10 # Common UDP services nmap -Pn -sU --top-ports 50 203.0.113.10
Scan only what is yours. Scanning addresses you do not own or have no written permission to test can breach law and provider terms. Confirm your public addresses with your internet provider before you start.
Step by step
A port review in six steps
Inventory what is exposed
Scan every public address from outside. Export the forwarding and inbound rules.
Match each port to an owner
Service, device, person, reason. No owner means the rule is disabled first.
Move remote access behind a VPN
Remote desktop, file sharing and management pages. See remote access VPN and MFA.
Restrict what must stay open
Limit by source address, and apply intrusion prevention to the rule.
Segment internally
The same thinking applies inside: staff do not need database ports; guests need nothing internal. See inter-VLAN routing and ACLs.
Document and schedule the next review
Keep the scan results. Repeat each quarter and after firewall changes.
A good review produces three things: a list of every port open to the internet with its owner and reason, a list of what was closed, and a dated scan that proves the result.
Common mistakes
Port and firewall mistakes we see most often
| Mistake | Why it matters | Fix |
|---|---|---|
| RDP published to the internet | Direct path to a computer inside | Remove; use the VPN. |
| Any-to-any rules | No port is really controlled | Specific rules. See rule base clean-up. |
| Device admin pages on the WAN | Control of the device is exposed | Management network and VPN. |
| Flat internal network | Every port on every device is reachable by everyone inside | VLANs and rules between them. |
| Clear-text protocols still in use | Passwords cross the network readable | Replace Telnet, FTP, HTTP, plain LDAP. |
| No record of why a port is open | Nobody dares close it | Owner, reason and review date on every rule. |
Sources read Nov 22, 2026: IANA, Service Name and Transport Protocol Port Number Registry; NSA, Network Infrastructure Security Guide; Nmap reference guide.
Have us do it
Prefer to hand this off?
A port review is part of our network security hardening and managed firewall work. We scan your public addresses, match every open port to a service and an owner, move remote access behind the VPN, restrict what remains and give you the before and after results. You receive a written scope and a written quote before any work starts.
Next in the library
Related guides
Want a quick self-check first? Try the free firewall rule review self-assessment.
This guide is for education and planning. Test in a maintenance window. IT Perfection is not affiliated with the vendors or agencies named on this page.

Who does the work
Written by Ali Hassani, CISSP, C|CISO
Ali Hassani has 25+ years of hands-on experience in IT operations, cybersecurity, Microsoft infrastructure, network security and Azure, and works with businesses in Irvine, Orange County and Los Angeles County. Design, implementation and troubleshooting work is planned and reviewed by Ali personally.
This guide is for education and planning. It does not replace a professional audit, compliance assessment or vendor engineering review. Updated November 2026.








FAQ
Common questions about network ports
What is the difference between TCP and UDP?
TCP sets up a connection and confirms that data arrived, which suits web, email and file transfer. UDP sends without a connection, which suits name lookups, voice and video where speed matters more.
Which ports should be closed on a firewall?
Inbound from the internet, everything that is not a deliberately published service. In particular remote desktop (3389), file sharing (445), Telnet (23), database ports and device management pages should never be open to the internet.
Is it safe to open port 3389?
Not to the internet. Remote desktop should be reached through a VPN with multi-factor sign-in. Changing the port number does not make it safe.
What is port 443 used for?
HTTPS, the encrypted web. Most cloud applications use it, which is why outbound 443 is allowed almost everywhere.
How can I check which ports are open on my network?
From inside, list the listening ports on each computer. From outside, scan your own public addresses with a tool such as nmap. Only scan addresses you own or have permission to test.
Can IT Perfection do this for us?
Yes. It is part of our network security hardening and managed firewall services for companies in Irvine, Orange County and Los Angeles County. Call 949-777-5567 or use the contact page to request a quote.
Need this done for your business?
IT Perfection plans, installs and supports this for companies in Irvine and Orange County
The guides explain the steps. If you would rather have it done, planned and documented by an experienced engineer, these are the services that cover it. Design, implementation and troubleshooting work is planned and reviewed by Ali Hassani personally.
Network design and installation
Firewall, switches, VLANs and Wi-Fi planned, installed and documented.
View serviceNetwork troubleshooting
Slow network, drops, Wi-Fi, VPN, DNS and DHCP problems traced and fixed.
View service