> Set up a Minecraft server on your PC and let friends join without touching your router. Step-by-step guide using a TCP tunnel.

**Author:** Localport Team | **Published:** 2026-02-25 | **Reading time:** 5 min read

**Tags:** gaming, tutorial

---

# How to Host a Minecraft Server Without Port Forwarding

You want to play Minecraft with friends. You're running a server on your PC. The problem: your friends can't connect because your computer is behind a router and firewall.

The usual advice is "set up port forwarding." That means logging into your router, finding the NAT settings, creating forwarding rules, hoping your ISP gives you a public IP, and praying nothing breaks when your IP changes.

There's a much easier way.

## What you need

- A Minecraft server running on your PC (Java Edition, default port 25565)
- Localport CLI installed ([30-second install](/docs/installation))
- A free Localport account ([sign up here](https://dashboard.localport.io))

## Step 1: Start your Minecraft server

If you haven't already, download and run the Minecraft server:

```bash
java -Xmx2G -Xms1G -jar server.jar nogui
```

Make sure it's running and you can connect locally at `localhost:25565`.

## Step 2: Start the tunnel

Open a new terminal window (keep the Minecraft server running) and run:

```bash
localport tunnel --token YOUR_TOKEN --local localhost:25565 --protocol tcp
```

You'll see:

```
Tunnel established. Forwarding:
  tcp → tcp://abc123.tunnel.localport.dev:47266
```

## Step 3: Share with friends

Send your friends the address: `abc123.tunnel.localport.dev:47266`

They add it as a server in Minecraft:

1. Multiplayer → Add Server
2. Server Address: `abc123.tunnel.localport.dev:47266`
3. Done → Join

That's it. No port forwarding, no router changes, no static IP.

> [!TIP] Keep both windows open
> The tunnel only works while the CLI is running. Keep both the Minecraft server terminal and the Localport terminal open during your gaming session.

## Tips for a smooth experience

- **Reserved ports** (Pro plan) keep the same port across sessions, so you don't need to share a new address every time you restart.
- **Latency is minimal** — Localport adds single-digit milliseconds, negligible for Minecraft.
- **Works behind any network** — University dorms, corporate WiFi, mobile hotspots, ISPs with CGNAT. If you can browse the web, Localport works.

## Works for other games too

| Game | Default Port | Tunnel command |
|---|---|---|
| Minecraft (Java) | 25565 | `--local localhost:25565 --protocol tcp` |
| Valheim | 2456 | `--local localhost:2456 --protocol tcp` |
| Terraria | 7777 | `--local localhost:7777 --protocol tcp` |
| Factorio | 34197 | `--local localhost:34197 --protocol tcp` |

[Get Localport free →](https://dashboard.localport.io/auth/login?mode=signup)