How to Port Forward a Minecraft Server (Java & Bedrock) — The Complete Guide

So you've set up a Minecraft server on your PC and your friends can't connect. The fix is almost certainly port forwarding — but before you spend the next hour digging through router menus, there's something you need to check first.

Roughly one in three people who attempt to port forward a Minecraft server discover — after hours of troubleshooting — that their internet connection makes it impossible. This guide starts by helping you figure out whether port forwarding will even work for you, then walks you through the entire process step by step.

Before You Start: Check If You Can Actually Port Forward

This is the step that every other guide skips, and it's the reason thousands of Minecraft players waste entire evenings for nothing.

Many internet service providers use something called CGNAT (Carrier-Grade Network Address Translation). It's a system where your ISP puts your router behind another router that you don't control. When CGNAT is in play, traditional port forwarding is impossible — no matter how perfectly you configure your settings.

Here's how to check in under 60 seconds:

On Windows:

  1. Press Windows Key + R, type cmd, and hit Enter.
  2. Type ipconfig and press Enter.
  3. Find your Default Gateway (usually something like 192.168.1.1).
  4. Now open a browser and go to your router's admin page by entering that gateway address.
  5. Look for a Status or WAN section and find your WAN IP or Internet IP.

On Mac:

  1. Open System Settings → Network and note your router's IP.
  2. Enter that IP in a browser to access your router admin panel.
  3. Find your WAN/Internet IP address in the status section.

Now compare:

  • Open a new tab and search "what is my IP" on Google.
  • If the IP address Google shows you matches your router's WAN IP — you're good. Port forwarding will work.
  • If they don't match, your ISP is almost certainly using CGNAT, and port forwarding won't work no matter what you do.

CGNAT red flags — if your router's WAN IP starts with any of these, you're behind CGNAT:

  • 100.64.x.x through 100.127.x.x
  • 10.x.x.x
  • 172.16.x.x through 172.31.x.x

What to Do If You're Behind CGNAT

You have a few options:

  • Contact your ISP and ask for a public IP address. Some providers will assign one for free; others charge a small monthly fee (typically €5–10/month).
  • Use a tunneling service like playit.gg or ngrok, which create a connection that bypasses CGNAT entirely.
  • Rent a hosted Minecraft server. This is by far the simplest option — you skip port forwarding, CGNAT issues, firewall headaches, and the performance hit of running a server on your own PC. Hosting starts from around $3–5/month and gives you a dedicated IP that anyone can connect to immediately.

If your IP addresses match and you're not behind CGNAT, let's move on to the actual setup.

Step 1: Set a Static Local IP Address

Every time your PC reconnects to your router, it might receive a different local IP address. That's a problem, because your port forwarding rule points to a specific IP. If it changes, the rule breaks and your friends get "Connection Timed Out."

The most reliable fix is a DHCP reservation on your router, which tells your router to always assign the same IP to your computer.

Find your current local IP first:

  • Windows: In that same Command Prompt, look at the IPv4 Address line from your ipconfig results. It'll be something like 192.168.1.105.
  • Mac: Go to System Settings → Network → Wi-Fi (or Ethernet) → Details → TCP/IP. Your IP is listed there.
  • Linux: Open a terminal and type ip addr or hostname -I.

Set the DHCP reservation:

  1. Log into your router's admin panel (the gateway address from earlier).
  2. Look for a section called DHCP, LAN Settings, or Address Reservation.
  3. Find your computer in the list of connected devices (or enter its MAC address and IP manually).
  4. Reserve the current IP address for your machine.

If your router doesn't support DHCP reservation, you can set a static IP directly on your computer instead — but the router method is preferred because it avoids IP conflicts with other devices on your network.

Step 2: Create the Port Forwarding Rule

Now for the main event. You need to tell your router: "When traffic arrives on Minecraft's port, send it to my PC."

Default Minecraft Ports

EditionPortProtocol
Java Edition25565TCP
Bedrock Edition19132UDP
Bedrock Edition (secondary)19133UDP

If you changed the port in your server.properties file, use whatever you set there instead.

Creating the Rule

  1. In your router's admin panel, find the Port Forwarding section. Different routers call it different things:
    • Linksys: Security → Apps and Gaming → Port Range Forward
    • Netgear: Advanced → Advanced Setup → Port Forwarding
    • TP-Link: Advanced → NAT Forwarding → Virtual Servers
    • ASUS: WAN → Virtual Server / Port Forwarding
    • Xfinity: Advanced → Port Forwarding (router at 10.0.0.1)
    • BT Hub: Advanced → Firewall → Port Forwarding
    • Fritz!Box: Internet → Permit Access → Port Sharing
  2. Create a new rule with these settings:
    • Service Name / Description: Minecraft Server (this is just a label)
    • Protocol: TCP/UDP (or just TCP for Java, UDP for Bedrock — if your router makes you choose one, create two separate rules)
    • External Port (or Start/End Port): 25565 for Java, 19132 for Bedrock
    • Internal Port: Same as external
    • Internal IP Address: The static IP you set up in Step 1
  3. Save the rule and restart your router if prompted.

A Note on Bedrock Edition

Bedrock requires UDP on port 19132. Some setups also need port 19133 forwarded. If players can't connect after forwarding 19132, add a second rule for 19133 with the same settings.

Step 3: Configure Your Firewall

Your router isn't the only thing blocking incoming connections — your computer's firewall probably is too. Even with perfect port forwarding, a blocked firewall will stop players from connecting.

Windows Firewall

  1. Open Control Panel → System and Security → Windows Defender Firewall.
  2. Click Advanced Settings on the left.
  3. Select Inbound Rules, then click New Rule on the right.
  4. Choose Port, click Next.
  5. Select TCP (for Java) or UDP (for Bedrock), and enter the port number (25565 or 19132).
  6. Select Allow the connection, click Next.
  7. Check all three profiles (Domain, Private, Public), click Next.
  8. Name the rule something like "Minecraft Server TCP" and click Finish.

Repeat this process for the other protocol if needed. A Java server technically only needs TCP, but creating both TCP and UDP rules avoids subtle connectivity issues for some players.

macOS Firewall

  1. Open System Settings → Network → Firewall.
  2. Click Options.
  3. Add the Java application (or your Minecraft server .jar launcher) and set it to Allow incoming connections.

Linux (UFW)

sudo ufw allow 25565/tcp for Java Edition

sudo ufw allow 19132/udp for Bedrock Edition

Step 4: Test Your Connection

Before you invite twenty friends to a server that doesn't work, test it yourself.

Quick Test

  1. Make sure your Minecraft server is running.
  2. Go to canyouseeme.org.
  3. Enter your Minecraft port (25565 or 19132).
  4. Click Check Port.

If it says the port is open, you're done. If it says closed or timed out, something in the chain isn't configured correctly (see Troubleshooting below).

Share Your Server Address

Find your public IP by searching "what is my IP" on Google. Give your friends this address to enter in Minecraft's multiplayer server list:

  • Java Edition: YOUR_PUBLIC_IP:25565 (or just YOUR_PUBLIC_IP if using the default port)
  • Bedrock Edition: Address: YOUR_PUBLIC_IP, Port: 19132

Important: Dynamic IP Addresses

Most residential internet connections have a dynamic public IP, which means it can change periodically. When it does, the address you gave your friends stops working.

Two solutions:

  • Free Dynamic DNS: Services like No-IP give you a hostname (like yourserver.ddns.net) that automatically updates when your IP changes. You install a small client on your PC that keeps it synced.
  • Hosted Minecraft server: A hosting provider gives you a permanent, fixed address that never changes — no DNS setup needed.

Troubleshooting

If you've followed every step and players still can't connect, work through this list:

"Connection Timed Out"

This is the most common error and it means traffic isn't reaching your server at all.

  • Double-check your port forwarding rule. The internal IP must match your PC's current local IP exactly.
  • Verify the server is actually running. Open Minecraft, go to Multiplayer, and try connecting to localhost. If that doesn't work, the server itself has a problem.
  • Check your firewall again. Temporarily disable Windows Firewall entirely and retest. If it works with the firewall off, your firewall rule is misconfigured. (Re-enable the firewall immediately after testing.)
  • Try port 25565 specifically. Some ISPs block certain port ranges. If you changed your Minecraft port to something custom, switch back to the default and test again.
  • Restart everything. Router, PC, Minecraft server — in that order. Some routers don't apply port forwarding rules until they reboot.

"Can't Resolve Hostname"

Your friends are entering the wrong address. Make sure they're using your public IP (the one from Google), not your local IP (192.168.x.x).

Port Shows as Closed on canyouseeme.org

  • The Minecraft server must be actively running when you test. The port only appears open when something is listening on it.
  • You may have a double NAT situation — a modem and a separate router, each with their own NAT. You'll need to either put the modem in bridge mode or set up port forwarding on both devices.
  • Your ISP might be blocking port 25565. Try changing the server port in server.properties to something like 25570, update your forwarding rule to match, and test again.

Friends on the Same Network Can't Connect Using the Public IP

This is called a hairpinning issue. Many routers don't support it. Players on your local network should connect using your local IP address (192.168.x.x), while external players use the public IP.

Everything Worked Yesterday But Not Today

Your public IP probably changed. Check it again with "what is my IP" and share the new one — or set up Dynamic DNS so this stops being a problem.

The Easier Alternative: Hosted Minecraft Servers

If you've read this far and thought "this is a lot of effort just to play with friends," you're not wrong. Port forwarding works, but it comes with ongoing maintenance: your PC needs to be running 24/7, your IP can change, your firewall might reset after an update, and your server's performance is limited by your home hardware and upload speed.

A hosted Minecraft server eliminates all of that. For a few dollars a month, you get:

  • A dedicated IP address that never changes — share it once and it works forever
  • 24/7 uptime without leaving your PC on
  • No port forwarding, no firewall configuration, no CGNAT headaches
  • Better performance — dedicated hardware with enterprise-grade internet connections
  • One-click mod and plugin installation on most hosts
  • Automatic backups so your world is safe
  • DDoS protection that you simply can't replicate at home

Frequently Asked Questions

Is port forwarding safe?

Port forwarding itself is a standard networking practice, but it does open a door into your network. You're exposing your PC's Minecraft server port to the entire internet. Keep your server software updated, don't forward more ports than necessary, and consider using a firewall rule that limits connections to known IP addresses if possible.

Can I port forward on mobile data or a hotspot?

No. Mobile carriers use CGNAT by default, and you have no access to port forwarding settings on a mobile connection. Use a tunneling service like playit.gg instead, or switch to a hosted server.

Do I need to port forward for LAN play?

No. Port forwarding is only needed for players connecting from outside your local network. Players on the same Wi-Fi or wired network can connect directly using your local IP address.

What if my ISP blocks port 25565?

Change the port in your server.properties file to something else (like 25570 or 443), update your port forwarding rule to match, and share the new port with your friends. They'll connect using YOUR_IP:NEW_PORT.