How to Port Forward a Minecraft Server (Port 25565): Router Steps and “Can’t Connect” Fixes

Minecraft Server Port Forwarding
Minecraft Server Port Forwarding

To port forward a Minecraft server, forward TCP port 25565 on your router to the local IP of the PC running the server, allow the port through that PC’s firewall, and give friends your public IP. 25565 is the default Minecraft Java server port; Bedrock servers use UDP 19132 instead. Below are the exact router and firewall steps, how to test the forward, and what each “can’t connect” error means when friends still can’t get in.

Which port does a Minecraft server use?

A Java Edition server listens on TCP 25565 by default, set by server-port in server.properties. That’s the only port players need. A few optional features use others, and you only open those if you use them.

Port Protocol Used for Forward it?
25565 TCP Java Edition game connections (default server-port) Yes
25565 UDP Query, only if enable-query=true Only for server-list tools that need it
25575 TCP RCON, only if enable-rcon=true No: RCON is unencrypted, keep it local
19132 UDP (Geyser: TCP and UDP) Bedrock Dedicated Server, or Geyser on a Java server Only for Bedrock players

To use a different port, change server-port (or start with --port 25570) and forward that one instead. Players then add it to the address: 203.0.113.25:25570.

Step 1: Give the server PC a fixed local IP

Your router forwards to a local address such as 192.168.1.50. Find it with ipconfig on Windows (the IPv4 Address line), ip addr on Linux, or System Settings → Network on a Mac. Then reserve that address for the PC in your router’s DHCP settings (“DHCP reservation” or “static lease”). Without it, the PC can get a new address after a reboot and the forward silently stops working.

Step 2: Forward port 25565 on your router

  1. Open the router’s admin page in a browser. Its address is the Default Gateway in ipconfig, usually 192.168.0.1 or 192.168.1.1. The login is often on a sticker on the router.
  2. Find Port Forwarding. Some routers call it Virtual Server, NAT, or Applications & Gaming.
  3. Create a rule: name Minecraft, external and internal port 25565, protocol TCP (or “Both”), internal IP = the server PC.
  4. Save, and restart the router if it asks.

Two routers in a row (an ISP modem-router plus your own)? That’s double NAT. The forward has to be on the router that connects to the internet, pointing at your second router, and again on the second one pointing at the PC. Or put the ISP box in bridge mode so only one router does NAT.

Step 3: Allow the port through the firewall

The first time the server starts on Windows, Defender Firewall asks whether to allow “OpenJDK Platform binary”. Allow it on private and public networks and Windows makes the rule for you. Missed the prompt? Run this in an administrator Command Prompt:

netsh advfirewall firewall add rule name="Minecraft Server" dir=in action=allow protocol=TCP localport=25565

On Linux with UFW: sudo ufw allow 25565/tcp. Third-party antivirus suites often have their own firewall that needs the same exception.

Step 4: Test the forward

Search “what is my IP” to get your public address. With the server running, have a friend outside your home add it in Multiplayer → Add Server. An online port checker also works, but only while the server is running: with nothing listening, the port always shows closed.

Testing from your own PC? Many routers can’t loop a connection back to your own public IP. Connect yourself with localhost (same PC) or the local IP (another device at home), and leave the public IP for friends.

Still can’t connect? Check for CGNAT

Compare the WAN or Internet IP shown on your router’s status page with the IP from “what is my IP”. If they’re different, or the router’s starts with 100.64 to 100.127, your ISP uses carrier-grade NAT and port forwarding can’t work from your side. Your options: ask the ISP for a public IP (sometimes a paid extra), use a VPN or tunnel (see Tailscale for Minecraft), or run the server somewhere with a public address already.

Your public IP changing every few days or weeks is a different problem: dynamic IP. A free dynamic DNS name keeps one address pointing at you, and a domain with an SRV record lets friends join without typing a port (how to add a domain name).

Minecraft can’t connect to server: “failed to connect” errors and what they mean

When friends are unable to connect, the wording of the error tells you where the connection broke. “Refused” means your friend reached a machine but nothing answered on that port. “Timed out” means nothing came back at all, usually a firewall, a missing forward or CGNAT. “Failed to bind” appears on the server, not the player, and means the port is already taken.

Error Where the connection broke Fix
Connection refused: getsockopt The address answered, but no server is listening on that port Check the server is running and finished starting; check the port number; check the forward points to the right PC
Connection timed out: getsockopt No reply at all Forward missing or wrong, firewall blocking Java, CGNAT, or the friend is using an old IP
Failed to bind to port (server console) Another program already uses the port, often a second copy of the server Close the other copy, or change server-port; leave server-ip blank
Timed Out / Disconnected mid-game The connection dropped after joining Unstable connection or firewall; use Ethernet and check the host’s upload
Outdated client / Outdated server Player and server are on different versions Match versions; see how to update a Minecraft server
Errors about mods or registry data Player’s mods don’t match the server’s Install the exact same mod list; see failed to synchronize fixes
Invalid session / failed to verify username The player’s account login, not your network Restart the launcher and sign in again; see authentication errors
You are not whitelisted on this server Whitelist on (default since 26.3) whitelist add Name; see the server properties guide

To find what’s holding port 25565 on Windows, run netstat -ano | findstr :25565; the last number is the process ID to end in Task Manager.

How to connect to a Minecraft server

Connecting works the same for any MC server. In Minecraft Java, open Multiplayer, click Add Server, and type the address: the public IP for friends outside your home, the local IP for players at home, localhost on the server PC itself. Add :port only if the server doesn’t use 25565. Direct Connection does the same without saving it. Friends on Xbox, PlayStation or phones are on Bedrock and can’t join a Java server directly; they need a Bedrock server (Bedrock setup guide) or Geyser on yours, with port 19132 forwarded (Geyser’s setup guide says to open it for both TCP and UDP).

Is port forwarding safe?

Forwarding one port to a Minecraft server is low risk if you keep the server locked down. Automated scanners look for servers on 25565, so the Minecraft Wiki recommends turning on the whitelist, keeping online-mode=true, keeping the server updated, and optionally using a non-default port or enable-status=false so the server doesn’t answer server-list pings. Never forward RCON, and remove the forward when you stop hosting.

No router access? Alternatives

  • Virtual LAN tools such as Hamachi, Radmin VPN or ZeroTier: everyone installs the same tool and joins with the virtual IP.
  • Tailscale: the same idea with less setup; see the Tailscale guide.
  • A hosted server, which already has a public address.

FAQ

What is the default Minecraft server port?

25565 (TCP) for Java Edition, 19132 (UDP) for Bedrock.

Why can’t my friends connect to my Minecraft server?

In order of likelihood: the port isn’t forwarded or points to the wrong local IP, the firewall blocks it, they’re using your local IP instead of your public one, your ISP uses CGNAT, or they’re on a different game version.

Do I need port forwarding to play with friends on the same Wi-Fi?

No. Players on your home network connect to the server PC’s local IP directly.

Why is my Minecraft server not connecting even on my own PC?

If localhost fails too, it isn’t the network: the server isn’t running, crashed during startup, or uses a different port than you’re connecting to. Read the end of the console or logs/latest.log before connecting again.

Should I forward TCP or UDP for Minecraft Java?

TCP is what the Java game connection uses. Choosing “Both” does no harm and covers Query if you turn it on later.

Can I run two servers on one IP?

Yes, on different ports: give the second server another server-port, forward that port too, and players add :port to the address.

Skip port forwarding entirely

A hosted server has a public address from the moment it starts. On GameTeam’s Minecraft server hosting there’s nothing to forward and no CGNAT to fight: the panel shows your address and port, friends add it, and you play, with DDoS protection included and 25+ locations to pick one near your group. If friends still can’t get in, ask the AI copilot “my friend gets connection refused, what’s wrong?” and it checks the server is up, reads the log, and checks the whitelist and version for you. Pay per GB of RAM from $0.49/GB a week, unlimited slots. Hosting yourself? The full setup is in how to make a Minecraft server, or skip the router for good with Minecraft server hosting.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts
Cookie Settings