DEV Community

COMSIAM
COMSIAM

Posted on

🔌 What is a Port and Port Forwarding? (Complete Guide)

If you’ve ever set up a server, CCTV, game server, or remote access—you’ve probably heard about ports and port forwarding.

But many people still don’t fully understand how they work.

This guide explains everything in a simple, practical way.

🔍 What is a Port?

A port is a communication endpoint used by devices to identify specific services or applications.

Think of it like:

👉 IP address = house address
👉 Port = room number inside the house

📡 Common Port Numbers

Here are some important ones:

80 → HTTP

443 → HTTPS

21 → FTP

22 → SSH

25 → SMTP

53 → DNS

Each port is used for a specific purpose.

⚙️ How Ports Work

When data arrives at your device:

IP tells which device

Port tells which application

Example:

192.168.1.10:80 → Web server

192.168.1.10:3389 → Remote Desktop

🔄 What is Port Forwarding?

Port forwarding is a method used to allow external devices (internet) to access services inside your private network.

Example:

Internet → Router → Internal device

🧩 How Port Forwarding Works

External request hits your public IP

Router checks port

Router forwards request to internal IP

Device responds

🏠 Real-World Use Cases

Port forwarding is used for:

🎮 Game servers

📹 CCTV remote viewing

💻 Remote Desktop (RDP)

🌐 Hosting websites

🗄️ NAS access

🔐 Port Forwarding and Security

Opening ports can be dangerous if done wrong.

Risks:

Unauthorized access

Hacking attempts

Always:

Use strong passwords

Limit open ports

Use firewall rules

⚠️ Common Problems

Port not opening

Wrong internal IP

ISP blocking ports

Double NAT issue

🧠 Pro Tips (From Real IT Work)

Use static IP for device

Avoid default ports (change for security)

Check with port scan tools

Use VPN instead of exposing ports (better security)

🔥 Port Forwarding vs NAT
Feature Port Forwarding NAT
Purpose Allow external access Translate IP
Usage Specific services General traffic
🛠️ Example Setup

Want CCTV access:

Public IP: 1.2.3.4

Internal IP: 192.168.1.100

Port: 8080

Setup:

👉 1.2.3.4:8080 → 192.168.1.100:80

📡 How to Check Open Ports

Use:

Online port checker

netstat

nmap

🔗 Learn More About Networking

For real-world port configuration, security setup, and advanced networking:

https://comsiam.com

✅ Conclusion

Ports and port forwarding are essential for making services accessible over the internet.

But they must be configured carefully to avoid security risks.

💬 Question for You

Have you ever tried port forwarding—and it didn’t work?

Top comments (0)