How to Check if a Port is Open (and How to Open It)
When a service isn’t reachable, checking if the correct port is open and listening is one of the first things to do. In this guide, we’ll show you how to:
- Test if a port is open using
telnet
or other tools - Understand the role of listening services
- Open a port on Windows or Linux
🧠 Before You Start: What Does “Open Port” Really Mean?
A port is considered "open" if:
- It's not blocked by a firewall
- A program is actively listening on that port
If no software is bound to the port, or if a firewall blocks it, it will appear closed, even if technically available.
🧪 How to Test if a Port is Open
📟 Method 1 — Using Telnet
Telnet is a simple way to test if a port responds.
On Windows or Linux:
telnet your.server.ip port
✅ If the port is open and a service is listening, the screen will go blank or show a banner.
❌ If not, you’ll see a connection error like “Connection refused” or “Could not open connection”.
🧪 Example:
telnet 192.168.1.100 22
🛠 Method 2 — Using Netcat (Linux)
If telnet
isn’t available, you can use nc
(Netcat):
nc -vz your.server.ip port
✅ You’ll see a success message if the port is open.
❌ Otherwise, it will time out or be refused.
🌐 Method 3 — Online Port Check Tools
You can also use an online port checker like:
⚠ These tools only work if the port is open to the public internet (not behind NAT or local firewall).
🔓 How to Open a Port
🪟 On Windows
- Open the Start Menu, type
Windows Defender Firewall
, and open it. - Click Advanced Settings on the left.
- Click Inbound Rules > New Rule...
- Choose Port, then click Next.
- Select TCP or UDP, and enter your port number.
- Choose Allow the connection, then click Next to finish the rule.
✅ Your port is now open in the Windows Firewall.
🐧 On Linux
Using UFW (Ubuntu):
sudo ufw allow 8080/tcp
sudo ufw reload
Using Firewalld (CentOS, RHEL, Alma, Rocky...):
sudo firewall-cmd --add-port=8080/tcp --permanent
sudo firewall-cmd --reload
✅ The port is now open in your Linux firewall.
🔁 Don't Forget: A Program Must Be Listening
Even if a port is open, it won’t respond unless something is listening on it.
Check with:
# Linux
sudo netstat -tulnp | grep :8080
# Windows (CMD)
netstat -an | find ":8080"
✅ If you see a result like LISTENING
, it means the port is in use.
❌ If not, your app might not be running or bound to the right port.
🎉 In Summary:
- A port must be open AND have an active service to be reachable
- Use tools like
telnet
,nc
, ornetstat
to check - Don't forget to configure the firewall on Windows or Linux
- Always make sure something is actually listening on the port!
Updated on: 03/04/2025
Thank you!