Blog / Networking
Port forwarding explained: how to open a port on your router
Port forwarding lets someone on the internet reach a device inside your home network. You need it to host a game server, reach a security camera or home storage from outside, or run a small web server. This guide explains how it works, how to set it up, and why it so often fails.
How port forwarding works
Your home has one public IP address, shared by every device on your network through your router. This sharing is called NAT (network address translation). Devices inside use private addresses such as 192.168.1.20, which cannot be reached directly from the internet.
When a connection arrives at your public address, the router has to decide which device should receive it. By default it blocks unsolicited connections. A port forwarding rule tells it what to do: “send traffic that arrives on port 25565 to the computer at 192.168.1.20”. If you are new to addresses, read Public IP vs static IP first, and Ports explained for what a port is.
Before you start
- Find the device’s local address. On Windows, run ipconfig and look for the IPv4 address. On macOS or Linux, use your network settings or ip addr.
- Give that device a fixed address. Set a DHCP reservation in the router, or a static address on the device. If the address changes, the rule will point at the wrong device.
- Know the port and protocol. Each program uses specific ports, and each is TCP, UDP or both. Check the program’s documentation.
- Make sure the program is running and allowed through the firewall on the device itself.
| Program | Typical default port | Protocol |
|---|---|---|
| Minecraft (Java Edition) | 25565 | TCP |
| Minecraft (Bedrock Edition) | 19132 | UDP |
| Plex Media Server | 32400 | TCP |
| Web server | 80 (HTTP), 443 (HTTPS) | TCP |
These are common defaults. Your program may use different ports, so check its settings.
Step by step
- Open your router’s settings. Type the router’s address into your browser. It is often 192.168.0.1 or 192.168.1.1, and it is listed as the “default gateway” in ipconfig. The login is often printed on a label on the router. If you still use the default password, change it.
- Find the right page. Look for Port forwarding, Virtual server, NAT or Applications & gaming. The name differs between brands.
- Create a rule. Enter a name, the external port (or range), the internal IP address of your device, the internal port (usually the same number) and the protocol.
- Save or apply. Some routers need a restart.
- Test it from outside your network. Find your public address with What is my IP, then use the port checker to see whether the port is open. The program must be running while you test.
Port forwarding, UPnP and DMZ
- UPnP lets programs open ports on the router automatically. It is convenient, but any program on your network can use it, so many people turn it off and use manual rules.
- DMZ forwards all unsolicited traffic to one device. It is the easiest setting and the riskiest, because that device is exposed on every port. Avoid it for anything other than short tests.
If it does not work
- Your provider shares your public address. Under carrier-grade NAT, many customers share one address and forwarding cannot work. A sign is that the address shown in your router’s status page differs from the one shown on What is my IP. Ask your provider for a public address, or use a VPN or tunnel service instead.
- Another router sits in front of yours. This is “double NAT”. Put the first device in bridge mode, or forward the port on both.
- The device’s address changed, so the rule points at nothing. Use a DHCP reservation.
- A firewall blocks the port on the device or on the router.
- The program is not running, or listens on a different port.
- The wrong protocol. A rule for TCP will not carry UDP. Note that the port checker tests TCP only.
- You are testing from inside your network. Some routers cannot loop traffic back to themselves. Test from mobile data or with an online checker.
- Your provider blocks the port. Some block common ports such as 25 or 80. Try a different external port.
- Your public address changed. Home addresses are often dynamic. A dynamic DNS service gives you a name that follows your address.
Keep it safe
Every forwarded port is a door into your network. Reduce the risk:
- Forward only what you need, and delete rules you no longer use.
- Do not forward services that should not face the internet, such as remote desktop (3389), file sharing (445), Telnet (23) or databases.
- Keep the software behind the port updated, and use strong, unique passwords.
- Changing to an unusual port cuts automated noise, but it is not real protection.
- For remote access to your own devices, a VPN is safer than opening ports.
Alternatives to port forwarding
If forwarding is blocked or too risky, a VPN lets you reach your home network without exposing services. Mesh VPN tools and tunnel or relay services also work behind carrier-grade NAT, because your device makes an outbound connection and nothing has to be opened on the router.
Quick checklist
- Give the device a fixed local address.
- Run the program and allow it through the device firewall.
- Create the rule with the right ports and protocol.
- Test from outside with the port checker.
- Remove the rule when you no longer need it.