Key Takeaway:
Port forwarding is a rule on your router that sends incoming connections on one port to one device on your home network. You need it to host something the internet must reach, such as a game server or a media server. It also exposes that device to everyone, so forward only what you need and never forward Remote Desktop, file sharing or databases. If your provider uses CGNAT, port forwarding can’t work at all, and a mesh VPN or tunnel is the way around it.
Most guides stop at “open your router and add a rule”. The rule is the easy part. What usually goes wrong is everything around it: the wrong internal address, a firewall on the device, or a provider that never gave you a public IP in the first place.
The Problem Port Forwarding Solves
Your home has one public IP address, the one the internet sees, and every device inside has its own private address, such as 192.168.1.100. See public vs private IP addresses if that’s new.
When you open a website, your router remembers the request and knows where to send the reply. When a stranger’s connection arrives with no request behind it, the router has no idea which device it’s for, so it drops it. That’s the NAT firewall doing you a favour, and it’s also why your home server can’t be reached.
A port forwarding rule gives the router the missing instruction: “anything arriving on port 25565 goes to 192.168.1.100.”
What a Port Is
An IP address identifies a device. A port number, from 0 to 65535, identifies a service on that device, so one machine can run a website and a game server at once. The standard splits the numbers into system ports (0 to 1023), registered ports (1024 to 49151) and dynamic ports (49152 to 65535). Here are the ones people ask about most, and whether forwarding them is sensible:
| Service | Default port | Forward it? |
|---|---|---|
| Minecraft Java server | 25565 | Yes, if friends connect from outside. Keep the server updated. |
| Plex media server | 32400 | Yes, for remote streaming, if its automatic setup fails. |
| Web server | 80, 443 | Only if you’re really hosting a site, and consider a tunnel instead. |
| SSH | 22 | Better through a VPN. If you must, use key login and no passwords. |
| Windows Remote Desktop | 3389 | No. Use a VPN. |
| Windows file sharing (SMB) | 445 | No. |
| Databases | 3306, 5432, 6379, 27017 | No. |
How It Works, One Connection at a Time
- You add a rule: external port 25565 goes to 192.168.1.100, port 25565.
- A friend types your public IP and the port into their game:
203.0.113.5:25565. - The connection reaches your router, which finds the matching rule.
- The router rewrites the destination from 203.0.113.5 to 192.168.1.100 and passes it inside.
- Your server answers, and the router rewrites the reply so it appears to come from your public address.
Nothing else on your network is touched. Your laptop and phone stay unreachable, because no rule points at them.
How to Set Up Port Forwarding
- Find your router’s address. On Windows, run
ipconfigand look for “Default Gateway”. On a Mac, runroute -n get default. On Linux, runip route. It’s usually something like 192.168.1.1. - Log in to the router. The default login is often on a sticker underneath. If it still works, change it while you’re there; see lock your router’s front door.
- Give the device a fixed local address. Look for “DHCP reservation” or “Address reservation” and tie one address to the device. Skip this and the rule quietly stops working the day the device gets a new address.
- Add the rule. It’s usually under Advanced, NAT, Virtual Server or Port Forwarding. Enter the external port, the device’s local address, the internal port and the protocol (TCP, UDP or both, as the software’s documentation says).
- Allow it on the device. Windows Firewall or a similar firewall on the device can still block the connection after the router has passed it on. Most server software offers to add the exception; otherwise add one for that port only.
- Start the service and test it from outside. A port only looks open when something is listening behind it.
🔍 How to Test It Properly
Test from outside your network. Many routers can’t loop a connection from inside back to your own public address, so a test from your own laptop can fail even when the rule is fine. Turn off Wi-Fi on your phone and connect over mobile data, or ask a friend to try.
Or use our Port Scanner with any VPN turned off. Type your port into the single-port box. It connects to your public address from our server, the way a stranger would, and shows whether the port is open, closed or not answering. It tests TCP only, so for UDP ports, which many game servers use, stick to the phone method.
The free lesson What’s Open to the Internet? walks through a full scan of your home connection, and how to check open ports shows how to see what’s listening on the device itself.
⚠️ Why Port Forwarding Isn’t Working
| Cause | How to check |
|---|---|
| You’re behind CGNAT | Compare the WAN address on your router with your address on What Is My IP. If they differ, or the WAN address is between 100.64.0.0 and 100.127.255.255, your provider shares a public address and no home rule can help. See what CGNAT is. |
| Double NAT | A provider modem and your own router both doing NAT. If the WAN address on your router is private, like 192.168.x.x, forward on both or put the modem in bridge mode. Router vs modem explains the difference. |
| The rule points at an old address | Check the device’s current local address against the rule, then set a reservation. |
| The device’s firewall blocks it | Connect from another device at home using the local address. If that fails too, the problem is on the device, not the router. |
| The service only listens locally | A service bound to 127.0.0.1 ignores everyone else. This lesson shows the difference on Linux. |
| Your provider blocks the port | Some home plans block certain inbound ports, often 25 and sometimes 80. Try a different external port, or ask your provider. |
| Your public address changed | Most home addresses are dynamic. Dynamic DNS gives you a name that follows it. |
The Security Trade-Off
A forwarded port is reachable by the entire internet, and automated scanners look at every address. If the service behind it has a security bug or a weak password, the attacker is now talking directly to a device inside your home.
Remote Desktop is the classic case. CISA’s ransomware guide says it plainly: “Do not expose services, such as remote desktop protocol, on the web.” Moving it to an unusual port doesn’t change much, because scanners don’t only look at the default ones.
If you do forward a port:
- Forward only the port you need, to only the device that needs it.
- Never use the “DMZ” setting as a shortcut. It sends everything to one device.
- Keep the software behind the port updated, and use a long, unique password.
- Delete the rule when you stop using it.
- Check that remote administration of the router itself is off.
UPnP: Port Forwarding You Didn’t Ask For
UPnP lets software on your network ask the router to open a port with no login and no prompt. Games and consoles use it because it’s convenient, and malware on your network can make the same request. Our advice: turn UPnP off unless something you use really needs it, and add manual rules instead. If you find an open port you can’t explain, look in the router’s UPnP table first.
Ways to Get Remote Access Without Opening Ports
| Option | How it works | Good for |
|---|---|---|
| Mesh VPN (Tailscale, ZeroTier) | Your devices find each other through the provider’s service. Tailscale says you usually don’t need to open any firewall ports. | Reaching your own devices, including from behind CGNAT |
| Cloudflare Tunnel | A small program on your server makes an outbound connection to Cloudflare, and visitors reach you through it. Your traffic passes through Cloudflare’s network. | Publishing a website or web app |
| Your own VPN at home (WireGuard) | You forward one port to the VPN server, then reach everything else through the encrypted tunnel. | Full home access, if you have a real public IP |
| Rented server as a relay | Your home machine connects out to a cheap server, which forwards visitors back along that connection. | Game servers behind CGNAT, if you don’t mind the setup |
On IPv6 the picture changes again. Devices have their own public addresses, so there’s nothing to forward, and you allow a connection through the router’s firewall instead. How NAT firewalls work covers why that matters. For hosting game servers specifically, IPv6 only helps if your players have it too.
Frequently Asked Questions
Is port forwarding safe?
It’s as safe as the service behind the port. An updated game server with nothing sensitive on the machine is a modest risk. Remote Desktop or a file share is a serious one. The rule itself isn’t the danger; what it exposes is.
What’s the difference between port forwarding and port triggering?
Forwarding keeps the port open all the time. Triggering opens it only after a device on your network makes an outgoing connection on a chosen port. That doesn’t suit a server, which has to be reachable before anyone inside does anything.
What’s the difference between port forwarding and DMZ?
Forwarding sends one port to one device. A router’s DMZ setting sends every port that has no other rule to one device, which removes most of the NAT protection for it.
Do I need port forwarding with a VPN?
Not to reach your own devices through a VPN you run. A commercial VPN is different: incoming connections would have to arrive at the VPN’s server, so your router’s rule does nothing. Some providers offer port forwarding on their servers and others don’t, so check before you rely on it.
Does port forwarding slow down my internet?
Not by itself. Only the traffic your hosted service actually handles uses your connection, and upload speed is usually what limits a home server. Our speed test shows yours.
Why does the scanner say “filtered” after I added the rule?
Usually the service isn’t running, the device’s firewall is dropping the connection, or you’re behind CGNAT. Work through the table above in order, and turn off any VPN first, because otherwise you’re scanning the VPN’s address.