How to Host a Minecraft Server Behind CGNAT
Friends reach a Minecraft server on a public IP address: TCP port 25565 for Java Edition, UDP port 19132 for Bedrock. Behind CGNAT your router has no public IPv4 address, so port forwarding can't work. The server PC has to open a connection outwards instead. You can use a relay such as playit.gg, which has a free plan, or have a public IP address of your own routed to the PC over a tunnel. Players then join the way they join any other server.
Server stuck behind CGNAT?
Get a static public IPv4 and IPv6 address delivered to your server PC over an encrypted tunnel. Map the Minecraft port in the app, and friends join by IP or by your own domain name.
The server runs, you can join it from another PC in the house, and nobody outside can. This guide explains why, compares the ways around it, and then sets up a Java or Bedrock server on its own public IP address.
Why your friends can't connect
To join, a player's game connects to your public IP address on the server's port. Normally your router holds that address and a port forward passes the connection to the server PC.
With CGNAT (carrier-grade NAT) your ISP shares one public IPv4 address among many customers, and your router gets an address from inside the ISP's network. A player's connection arrives at the ISP, which has no rule for you, and stops there. Your router never sees it, so no setting on it helps. Most mobile and 5G home connections work this way, and so do Starlink's Residential and Roam plans.
To find out whether this is your problem, compare the IPv4 address on your router's WAN page with the result of this command:
curl -4 ip.getpublicip.com
If they differ, or the router's address is between 100.64.0.0 and 100.127.255.255, you are behind CGNAT. How to check if you're behind CGNAT has the full tests. If the two addresses match, you have a public IP and the forward itself is failing, which port forwarding not working covers.
The ways around CGNAT
Each of these works because the server opens the connection outwards, which CGNAT allows.
| Option | Players connect to | Cost | Drawback |
|---|---|---|---|
| A relay such as playit.gg | An address the relay gives you | Free tier, paid plans | Your players' traffic goes through the relay's network |
| A mesh VPN such as Tailscale | Your PC's address on the private network | Free plan for personal use | Every player has to install it and join your network |
| A paid Minecraft host | The host's server | A monthly fee | The world runs on the host's hardware |
| A VPS you set up as a relay | The VPS's address | The VPS rental | You build and maintain the tunnel and firewall yourself |
| A public IP over a tunnel (GetPublicIP) | Your own static IPv4 and IPv6 address | $8.99 USD a month per IP | It isn't free, and the tunnel adds a hop |
If you play with a few friends now and then, start with playit.gg. Its free plan covers Minecraft Java and Bedrock.
A public IP of your own is the better fit when you want any of these:
- An address that is yours and stays the same, so you can point your own domain name at it with ordinary DNS records.
- The players' real IP addresses in the server log, so IP bans work as they would on any public server.
- More than Minecraft on the same machine: a web map, a voice server or a website on the same address, on whichever ports you open.
Set up the server on a public IP
GetPublicIP routes a static public IPv4 and IPv6 address to your PC over an encrypted WireGuard tunnel. The PC opens the tunnel outwards, and connections to the address come back through it on the ports you map. Nothing changes on your router.
1. Check the server on your own network
Start the Minecraft server and join it from another device at home, using the server PC's local address (for example 192.168.1.50). If that fails, fix it first: the tunnel can only deliver connections to a server that accepts them.
For a Java server, leave server-ip= empty in server.properties, so the server listens on every address of the PC. Note the port in the same file: server-port=25565 for Java, server-port=19132 for Bedrock.
2. Order an IP address and create an API key
Sign up, order an IP address and choose a location. Pick the one closest to you, or between you and most of your players, because every player's connection passes through it. There are 32 locations.
Then create an API key for the address. The apps below sign in with it.
3. Connect the server PC and map the port
Follow the part for your system.
Windows
- Download and install GetPublicIP for Windows.
- On the Status tab, paste your API key and click
Connect. - On the Port Mappings tab, click
Add. For Java, set the public port to25565and the protocol to TCP. For Bedrock, set the public port to19132and the protocol to UDP. ClickSave.

The app adds the Windows Firewall rule for the port. The Listening column then shows the program on that port and whether forwarded connections can reach it.
The app starts in Full tunnel, where all of the PC's traffic uses your GetPublicIP address. Split tunnel sends only the mapped ports through it, and a Java server works the same in both. A Bedrock server is UDP: in Split tunnel its first reply to each new player is lost and the ones after it arrive normally. If Bedrock players have trouble joining, switch back to Full tunnel.
Linux
The client supports Ubuntu 26.04 and Debian 13. Install it, then run sudo getpublicip, paste your API key and choose Split mode, which keeps SSH and the server's own downloads on your normal connection.
Map the port for your edition:
sudo getpublicip ports add 25565/tcp # Java
sudo getpublicip ports add 19132/udp # Bedrock
The client opens the port in ufw, firewalld or iptables. Check the result with:
sudo getpublicip ports
It lists your ports and warns you if the server can't be reached, for example because it only listens on 127.0.0.1.
Mac
Install GetPublicIP for Mac, sign in with your API key, and add the mapping on the Port Mappings tab: public port 25565 with TCP for a Java server.
Mojang publishes the Bedrock server for Windows and Ubuntu only. On a Mac, run a Bedrock server in Docker, as described next.
Docker
If the server runs in a container, add the GetPublicIP container to the same Compose project and point a mapping at the Minecraft service. This example uses the itzg/minecraft-server image for a Java server:
services:
mc:
image: itzg/minecraft-server
restart: unless-stopped
environment:
EULA: "TRUE"
volumes:
- ./data:/data
networks:
- appnet
getpublicip:
image: ghcr.io/getpublicip/getpublicip:latest
restart: unless-stopped
environment:
GETPUBLICIP_API_KEY: "${GETPUBLICIP_API_KEY}"
GETPUBLICIP_MAPPINGS: "25565/tcp->mc:25565"
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
sysctls:
net.ipv4.ip_forward: 1
net.ipv4.conf.all.src_valid_mark: 1
net.ipv6.conf.all.forwarding: 1
networks:
- appnet
networks:
appnet:
Put GETPUBLICIP_API_KEY=your-api-key in a .env file beside it and run docker compose up -d. For Bedrock, use a Bedrock server image and the mapping 19132/udp->mc:19132.
In Docker the server sees every connection as coming from the GetPublicIP container. To see each player's own address, turn on GETPUBLICIP_PRESERVE_CLIENT_IP; the Docker page explains what that needs.
4. Test from outside
Ask a friend to join using your public IP address, or try it yourself from a device on mobile data with Wi-Fi turned off. In Java Edition, choose Multiplayer, then Add Server, and enter the address. In Bedrock, open the Servers tab and add a server with the address and port 19132.
Use a name instead of the IP address
The address doesn't change, so a normal DNS record is enough. At your DNS provider, add an A record:
mc.example.com. A 203.0.113.10
Players then join mc.example.com. Use your own address in place of 203.0.113.10.
If a Java server runs on a port other than 25565, an SRV record lets players leave the port out:
_minecraft._tcp.mc.example.com. SRV 0 5 25570 mc.example.com.
Bedrock doesn't read SRV records, so Bedrock players enter the port in the Add Server form.
Java and Bedrock on one address
One address carries both. Map TCP 25565 for a Java server and UDP 19132 for a Bedrock server, and run them side by side. If you run a Java server with the Geyser plugin so that Bedrock players can join it, map both ports to that one server.
Lag and location
A tunnel adds one hop. A player's connection goes to the GetPublicIP location you chose, then through the tunnel to your home. The extra delay depends on how far that location is from you and from your players, which is why step 2 says to choose a close one. The server's performance still depends on your own PC and on your connection's upload speed.
Keep a public server safe
Scanners look for open Minecraft ports on every public address, whoever provides it.
- Turn on the whitelist for a private server:
white-list=trueinserver.propertiesand/whitelist add <name>for each player. On Bedrock the setting isallow-list=true. - Keep
online-mode=true, so the server checks each player's account. - Map only the game port. Leave RCON (port 25575 by default) unmapped.
- Players and scanners see your GetPublicIP address. Your home IP address stays out of it.
Troubleshooting
When a player sees "Connection timed out", nothing answered. Check that the tunnel is connected and that the port is mapped with the right protocol: TCP for Java, UDP for Bedrock.
When a player sees "Connection refused", the connection reached your PC and no program accepted it. The Minecraft server is stopped, or it listens on a different port from the one you mapped.
If the server works at home and not from outside, look at the Listening column in the Windows or Mac app, or run sudo getpublicip ports on Linux. Each one tells you whether a program is listening on the mapped port and whether it can be reached. A server with server-ip=127.0.0.1 accepts connections only from the PC itself.
Players in your own house can keep using the server PC's local address, which is the shorter path.
Frequently asked questions
Can I host a Minecraft server behind CGNAT?
Yes, but not with port forwarding. Behind CGNAT your router has no public IPv4 address, so a forward on it does nothing. The server has to open a connection outwards instead: to a relay such as playit.gg, or to a service that routes a public IP address to it, such as GetPublicIP. Players then connect to the relay's address or to that public IP.
How do I host a Minecraft server without port forwarding?
Run a program on the server PC that connects outwards and brings the players' connections back in. playit.gg does this with a relay and has a free plan. GetPublicIP does it by routing a static public IPv4 and IPv6 address to the PC over a WireGuard tunnel, and you map TCP 25565 (Java) or UDP 19132 (Bedrock) in the app. Neither needs any change on the router.
What ports does a Minecraft server use?
Java Edition uses TCP port 25565 by default. Bedrock Edition uses UDP port 19132. Both can be changed with server-port in server.properties. Java players can leave the port out of the address when it is 25565.
Do my friends need to install anything to join?
Not with a public IP or a relay such as playit.gg: they type the address into Minecraft like any other server. With a mesh VPN such as Tailscale, every player has to install it and join your network first.
Is playit.gg enough, or do I need my own public IP?
For a few friends playing now and then, playit.gg's free plan is often enough and costs nothing. Your own public IP makes sense when you want an address that is yours and doesn't change, your own domain name with ordinary DNS records, the players' real IP addresses in the server log, or other services on the same machine such as a web map or voice chat.
Does a tunnel add lag to a Minecraft server?
It adds one hop: players reach the tunnel provider's server first, and it passes the traffic to your home. How much that costs depends on where that server is. Choose the location closest to you, or between you and most of your players.
Can I host a Minecraft server on Starlink?
Yes. Starlink's Residential and Roam plans use CGNAT, so port forwarding doesn't work, but outbound connections do. A relay or a public IP delivered over a tunnel both work on Starlink, because the server PC opens the connection outwards.
Related guides
- How to check if you're behind CGNAT: three tests, and how to tell CGNAT from double NAT
- Port forwarding not working?: the six usual causes when you do have a public IP
- Expose a home server to the internet: the same options for services other than Minecraft
- Expose Docker containers to the internet: more on the Compose setup used above