Port forwarding tells your home router to send incoming game traffic to the right PC. Here's how to do it, the ports to open, and why it sometimes can't work at all.
Quick answer
To port forward a game server, give the server PC a fixed local IP, log in to your router (usually 192.168.0.1 or 192.168.1.1), open the Port Forwarding or Virtual Server section and forward the game's port and protocol to that IP — for example TCP 25565 for Minecraft or UDP 2456–2458 for Valheim. Then allow the same port in your firewall. If your ISP uses CGNAT, port forwarding cannot work.
What port forwarding does
Your router shares one public IP across every device. When a friend connects to your game, the router needs to know which PC to hand that traffic to — a port-forward rule maps a port to your PC's local IP.
Step 1: give your PC a static local IP
Forwarding breaks if your PC's local IP changes. Set a DHCP reservation in the router, or a static IP on the PC (e.g. 192.168.1.50).
Step 2: forward the game's port
In your router (usually at 192.168.1.1) → Port Forwarding, add a rule pointing the game port to your PC's local IP. Common ports:
Minecraft (Java) 25565 TCP
CS2 / Source 27015 UDP+TCP
Rust 28015 UDP
Valheim 2456-2457 UDP
FiveM 30120 TCP+UDPStep 3: allow it in your firewall
Windows Firewall must allow the same port inbound, or the router forwards traffic to a PC that drops it. Add an inbound rule for the port/protocol.
Step 4: test from outside
Have a friend connect using your public IP (not 192.168.x.x), or use our server status checker from outside your network.
Many ISPs (especially mobile/fibre) put you behind Carrier-Grade NAT, so you don't have a real public IP — and no amount of port forwarding will work. If your router's WAN IP differs from your public IP, you're on CGNAT.
The simpler answer: host it elsewhere
A hosted game server has a real public IP, the ports open by default, no router config, no exposing your home IP, and DDoS protection. For anything beyond a quick LAN-style session with friends, it's the easier and safer route.
Port forwarding works until CGNAT, a dynamic IP or your home upload ruins it. A hosted server skips all three.
Port forwarding not working? Check these first
- Double NAT — a modem sitting in front of your router can need forwarding on both devices, or bridge mode enabled on the modem.
- UPnP conflicts — if UPnP already opened a different mapping for that port, a manual rule can silently be ignored; disable UPnP for that port and set the rule manually instead.
- Wrong protocol — many games need both TCP and UDP, or a full port range, not a single port.
- ISP-level port blocking — some ISPs block certain ports (like 25) outright regardless of your own router settings.
How to prevent port forwarding problems
- Set the DHCP reservation before forwarding, so the rule never goes stale after a router reboot changes your PC's local IP.
- Keep a note of every port rule you've added, so you can debug or remove one later without guessing.
- Re-test with a server status checker after every router firmware update — updates sometimes silently reset forwarding rules.
Related networking guides
If forwarding looks correct but players still can't join, see "Connection timed out" joining a game server. To find the exact address to share once it works, read how to find your server's IP and port. If the connection is up but choppy, see what causes packet loss.