Want to host a game server so friends can join from anywhere? You need to port forward a game server on your router. This guide walks you through every step — from finding your router’s IP to verifying the port is open. I have hosted Minecraft, Valheim, and CS2 servers for years, and I have run into every pitfall you can imagine. By the end of this article, you will have a working setup that friends can connect to from across the internet.
Many guides skip the parts that actually trip people up — static IP setup, protocol selection, CGNAT, and router interface differences. We will cover all of those so you do not waste a weekend troubleshooting.
Table of Contents
What Is Port Forwarding and Why Do You Need It for Game Servers?
Port forwarding is a router configuration that tells your network equipment where to send incoming internet traffic. When someone outside your home tries to join your game server, the connection hits your router first. Without a forwarding rule, your router blocks that connection because it does not know which device on your local network should receive it. Port forwarding solves this by mapping a specific external port to a specific internal IP address and port.
Game servers rely on this because multiplayer traffic is bidirectional and persistent. Your friends need to be able to reach your server’s IP and port number without your router acting as a wall. I learned this the hard way when I first tried to host a Minecraft server — my friends kept getting “connection timed out” errors until I forwarded port 25565. That single rule opened up the server to the world.
Without port forwarding, only devices on the same Wi-Fi can connect to your server. For most people, that defeats the entire purpose of hosting. Whether you are running a Valheim dedicated server, a Rust box, or a Palworld session, the workflow is identical: reserve an IP, log into the router, create a forwarding rule, test it.
The role of NAT and your router’s firewall
Your router uses Network Address Translation (NAT) to share one public IP address among all your devices. NAT is great for security — it hides your local devices from the internet by default. The downside is that incoming connections have no natural path to a specific device. Port forwarding punches a deliberate hole through NAT for one specific service, which is exactly what game servers need.
Finding Your Router’s IP Address and Logging In
Before you can port forward a game server, you need access to your router’s admin panel. This is almost always done through a web browser. The router’s address is called the default gateway, and it is typically 192.168.1.1, 192.168.0.1, or 10.0.0.1. Here is how to confirm yours.
On Windows
Press Win + R, type
cmd, and press Enter.Type
ipconfigand press Enter.Look for “Default Gateway” — that is your router’s IP address.
On macOS
Open System Settings, then click Wi-Fi.
Click “Details” next to your connected network.
Find the “Router” address.
On Linux
Open a terminal.
Run
ip route | grep default.The address shown after “via” is your router IP.
Type that address into your browser’s address bar. You will see a login page. Default credentials are usually printed on the back of your router, and common combinations include admin/admin, admin/password, or admin/(blank). If you have changed them and forgotten, you may need to reset the router — but try the defaults first.
Our team has compiled a list of common router default credentials for brands like Netgear, TP-Link, Linksys, and Asus on our router login pages. Once you are in, look for a section called “Port Forwarding,” “Virtual Server,” “NAT Forwarding,” or “Advanced Routing.”
Setting Up a Static IP for Your Game Server
Port forwarding routes traffic to a specific internal IP address. If your game server’s IP changes, the forwarding rule points to nothing. That is why a static IP is critical. You have two main options: a manual static IP or a DHCP reservation. Both work; reservations are easier to manage.
A DHCP reservation tells your router to always assign the same IP to a specific MAC address. The device still uses DHCP, so you do not hard-code anything on the server itself. This is what I recommend for most people because it survives router reboots and network changes.
How to create a DHCP reservation
Find your game server’s MAC address. On Windows, run
ipconfig /alland look for “Physical Address.” On Linux, runip link.In your router admin panel, find the “DHCP Reservation” or “Address Reservation” page.
Add a new entry linking the MAC address to your desired IP, such as
192.168.1.50.Save and reboot the device so it picks up the new lease.
If you prefer, you can also assign a manual static IP directly on the server. Just make sure the IP is outside your router’s DHCP range to avoid conflicts. For example, if your router hands out 192.168.1.100 through 192.168.1.200, set your server to 192.168.1.50.
Understanding TCP vs UDP for Gaming
Every port forward rule uses either TCP, UDP, or both. Most modern games use UDP because it is faster and has lower overhead. UDP does not guarantee packet delivery, but that is fine for real-time games where a missed position update is less important than getting the next one quickly. TCP, on the other hand, guarantees delivery but adds latency.
Minecraft is a notable exception. Minecraft’s server runs on TCP port 25565. Most other big titles — CS2, Valheim, Rust, Ark, Palworld, Terraria — run primarily over UDP. When in doubt, set your port forward rule to “Both” or “TCP/UDP.” The server will only respond on the protocol it actually uses, so leaving both open does not cause problems.
Here is a quick rule of thumb that has served our team well: if a game’s wiki or dedicated server documentation specifies TCP, use TCP. If it specifies UDP, use UDP. If it says nothing, choose “Both.” This matches what experienced admins on self-hosted forums recommend and avoids 90% of “why is my server not showing up” headaches.
Step-by-Step Port Forwarding Configuration
Now we get to the core of how to port forward a game server on your router. The exact wording changes between brands, but the underlying steps are identical. I have done this on Netgear, TP-Link, Linksys, and Asus routers, and the pattern holds.
Step 1: Open the port forwarding section
In your router admin panel, navigate to the port forwarding area. On Netgear, this is under “Advanced” then “Advanced Setup” then “Port Forwarding / Port Triggering.” On TP-Link, look under “Forwarding” then “Virtual Servers.” On Asus, it sits under “WAN” then “Virtual Server / Port Forwarding.” On Linksys, it is usually under “Smart Wi-Fi Tools” or “Connectivity.”
Step 2: Add a new rule
Click “Add Custom Service” or the equivalent button. You will be asked for several fields:
Service Name: A label so you remember what the rule does. Use the game name, like “Minecraft Server.”
Protocol: TCP, UDP, or Both.
External Port (or Start/End): The port the outside world will connect to.
Internal Port: Often the same as external, but can differ if you want.
Internal IP: The static IP of your game server.
Step 3: Save and apply
Click “Apply” or “Save.” Most routers do not require a reboot, but some older models do. I always reboot anyway — it eliminates a class of “is it really working” bugs. After reboot, your rule should be active.
Step 4: Note your public IP
Find your public IP by visiting a site like whatismyip.com. This is what your friends will use to connect — combined with the port. For example, 203.0.113.42:25565 for Minecraft. If your public IP changes often, you will want to set up dynamic DNS, which we cover later.
This is the workflow that mirrors the noip.com featured snippet, and it works on virtually every consumer router sold in the last decade.
How to Test if Your Port Forwarding Works
After creating the rule, you need to verify it actually works. There is nothing worse than telling your friends to join only to find out the port is still closed. Use a port checker tool from outside your network — testing from the same network almost always lies because of NAT hairpinning limitations.
Option 1: Use an online port checker
Websites like canyouseeme.org, yougetsignal.com, and portchecker.co let you paste a port number and check if it is open. These tools connect from a remote server, so they give you the real-world answer. If the tool reports “open,” you are good. If it reports “closed” or “timeout,” something is wrong — usually the wrong IP, the wrong protocol, or a firewall blocking the connection.
Option 2: Ask a friend to connect
The most honest test is having someone outside your network try to connect with the game’s client. Give them your public IP and port. If they get in, you are done. If not, go to the troubleshooting section below.
Option 3: Use netcat from another machine
Tech-savvy readers can test with nc -zv your.public.ip port from a remote server or VPS. A “succeeded” message confirms the port is reachable.
Whatever method you pick, test before you invite 20 friends to a launch night. I learned this the hard way with a Rust server — I had forwarded the wrong protocol and spent an hour wondering why nobody could connect.
Common Game Server Ports Reference
One of the most common questions on forums and Reddit is “what ports do I need to forward for [game]?” Here is a quick reference table for popular titles. All ports assume default configuration — if you have changed any in your server config, use those values instead.
Game port reference table
Minecraft Java Edition: TCP 25565 (server query), TCP 25575 optional for RCON
Minecraft Bedrock: UDP 19132 (primary), UDP 19133 (secondary/LAN)
CS2 (Counter-Strike 2): UDP 27015 (game), TCP 27015 (often used together)
Valheim: UDP 2456 (game), UDP 2457 (query)
Rust: UDP 28015 (game client), TCP 28016 (RCON)
Palworld: UDP 8211 (game)
Ark: Survival Evolved/Ascended: UDP 7777 (game), TCP 27015 (Steam query), UDP 27015
Terraria: TCP 7777
7 Days to Die: UDP 26900 (game), TCP 26901 (Web Remote)
Left 4 Dead 2: UDP 27005 (game), UDP 27015 (client)
For games like Valheim that use Crossplay, you actually do not need to port forward at all — matchmaking handles everything. The same is true for many modern games with built-in relay servers. Port forwarding is mainly needed for the games listed above and dedicated server emulators. This is a point worth flagging before you spend time configuring rules you do not need.
Security Considerations When Port Forwarding
Opening a port to the internet is not free. Every forwarded port is a path into your network, and there are real risks. That said, with basic precautions, port forwarding a game server is safe enough for home use. Let me share the precautions I always follow.
First, only forward the ports you actually need. Do not forward a huge range “just in case” — that is how attackers find soft targets. Second, keep your server software up to date. Most game server exploits target unpatched versions. Third, run a host firewall on the game server itself. Windows Firewall or iptables should be configured to allow only the game ports and block everything else.
Set strong passwords on any RCON or admin panel. Use a unique, long password and consider IP allowlisting if the game supports it. I have seen community servers compromised because someone used “password123” as the admin password — once an attacker finds the port, weak passwords are an open door.
Forum users on r/selfhosted and r/HomeNetworking often recommend using Tailscale or ZeroTier instead of port forwarding, primarily for security. Those tools are great, but they require your friends to install the same software. For pure convenience and zero client installs, port forwarding remains the right choice for most home hosts.
Troubleshooting Common Port Forwarding Issues
Even with the right steps, things break. Here are the failure modes I have seen most often, and how to fix them.
The port still shows as closed
Double-check the internal IP in your port forward rule — it must match your game server’s current IP exactly. If you set a static IP but the server is still pulling a different one from DHCP, the rule points nowhere. Confirm the server’s actual IP with ipconfig or ip addr before debugging anything else.
Firewall is blocking connections
Windows Firewall, in particular, silently blocks incoming traffic by default. Add an inbound rule for the game server’s executable and the relevant ports. If you use third-party antivirus with its own firewall (Norton, McAfee, Kaspersky), it can override Windows Firewall — temporarily disable it to confirm the issue, then add an exception.
You are behind CGNAT
Many ISPs use Carrier-Grade NAT, which means you do not have a real public IP at all. Port forwarding is impossible in this case. Call your ISP and ask for a public IP — sometimes it is free, sometimes it costs a few dollars per month. If they refuse, your best option is an alternative like Tailscale, ZeroTier, or playit.gg, which we cover below.
Double NAT
If you have a router behind another router (modem-router combo plus your own router, for example), both layers are NATing. You need to either put the first device in bridge mode or forward ports on both devices in a chain. Double NAT is the cause of many “port forward does not work” mysteries.
Dynamic IP changes
If your public IP changes frequently, your friends will lose connection. Set up dynamic DNS through a service like No-IP or DuckDNS. This gives you a stable hostname that always points to your current IP.
Alternatives to Port Forwarding (VPN, Tailscale, ZeroTier)
If port forwarding is not possible — usually because of CGNAT — there are modern alternatives that get around the issue entirely. None require changes to your router. I have used all three of these for different scenarios and they each have a place.
Tailscale creates a mesh VPN between your devices using WireGuard under the hood. Your friends install the Tailscale client, you share your node, and they connect as if they are on your LAN. It works behind any NAT. ZeroTier is similar but more DIY-oriented and slightly more complex to set up. Both are excellent if you can get your friends to install a small client.
playit.gg is purpose-built for game servers. It creates an outbound tunnel that bypasses CGNAT and gives you a stable hostname your friends can use. No router configuration needed at all. The free tier covers most use cases. This is what I recommend when someone’s ISP refuses to give them a public IP — it solves the problem in 10 minutes.
If you are running your game server inside Docker, remember to forward ports from the container to the host. Docker’s port mapping (-p 25565:25565) handles this on the host side, but you still need to port forward from the router to the host’s IP. This trips up many Docker users, so it is worth flagging.
Frequently Asked Questions About Port Forwarding Game Servers
How to set up port forwarding for gaming?
Log into your router’s admin panel using its default gateway IP, navigate to the port forwarding or virtual server section, create a new rule with the game’s TCP or UDP port, point it at the static internal IP of your game server, save, and reboot. Test the port from an external checker tool before inviting friends.
How to port forward with your router?
Open a browser and enter your router’s IP address (usually 192.168.1.1 or 192.168.0.1), log in with admin credentials (often printed on the router), find the port forwarding menu under Advanced or NAT settings, add a new rule specifying protocol, external port, internal port, and your game server’s static IP, then save and apply.
Is port forwarding safe for game servers?
Port forwarding is reasonably safe if you only forward the ports your game needs, keep server software updated, and run a host firewall on the game server itself. Avoid forwarding large port ranges, use strong RCON passwords, and consider Tailscale or ZeroTier if you want to avoid opening ports at all.
What ports do I need to forward for Valheim server?
Valheim dedicated servers use UDP 2456 for the main game traffic and UDP 2457 for the query port. Set your port forward rule to UDP for both ports, point them at your server’s static IP, and your friends will be able to connect.
What ports to forward for CS2?
CS2 uses UDP 27015 for game traffic and TCP 27015 for Steam query. Forward both as UDP and TCP (or set the protocol to Both), pointing at your dedicated server’s static IP. If you run multiple instances, add +1 to each port per instance (27016, 27017, etc).
Is Minecraft port 25565 TCP or UDP?
Minecraft Java Edition uses TCP port 25565 for all game traffic. Set your port forward rule to TCP. Minecraft Bedrock Edition uses UDP 19132 for the primary port and UDP 19133 for LAN, so forward UDP for Bedrock servers.
Final Thoughts on Port Forwarding Your Game Server
That covers everything you need to port forward a game server on your router step by step. The process is the same regardless of which game you host: reserve a static IP, log into your router, create a forwarding rule, and test it. Most failures come from mismatched IPs, wrong protocols, or hidden firewalls.
If port forwarding is not an option because of CGNAT or a stubborn ISP, remember that tools like Tailscale, ZeroTier, and playit.gg exist to work around the problem. Our team has helped dozens of admins get their servers online, and one of those alternatives almost always solves the case when traditional port forwarding fails. Pick the game, follow the steps, and get your friends online.