> For the complete documentation index, see [llms.txt](https://docs.tcpshield.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tcpshield.com/vxlan/sentry-tunnel-for-rathena-ragnarok.md). Agents can also search and read this documentation through its [MCP server](https://docs.tcpshield.com/~gitbook/mcp).

# Sentry Tunnel for rAthena / Ragnarok Online

Protect your Ragnarok Online private server (rAthena, Hercules, Gepard Shield) from DDoS attacks with TCPShield Sentry Tunnel and the rAthena ProtoGuard filter. Real player IPs, no source patches.

This guide shows how to protect a Ragnarok Online private server running **rAthena** with TCPShield Sentry Tunnel, and how to lock its login, char and map servers to the **rAthena** ProtoGuard filter. The same steps apply to Hercules-based servers and to servers running Gepard Shield.

Because Sentry Tunnel is a VXLAN tunnel and not a proxy, rAthena still sees every player's **real IP**. IP bans, `@iplog`, multi-client limits, FluxCP logs and Gepard's own checks keep working with no source changes.

## Gepard Shield support

{% hint style="success" %}
**Sentry Tunnel and the rAthena ProtoGuard filter are fully compatible with Gepard Shield.** You don't need a special build, a source patch or any change to your Gepard configuration.
{% endhint %}

Why it works with Gepard out of the box:

* **Nothing is decrypted or rewritten.** Sentry Tunnel carries each packet to your server exactly as the client sent it, so Gepard's encrypted traffic, client checks and keep-alives reach your server untouched.
* **Real player IPs, natively.** Gepard and rAthena see the player's real address, not a proxy's. IP bans, hardware-ID bans, multi-client limits and Gepard's own logs keep working as before.
* **The filter stays out of Gepard's way.** The rAthena ProtoGuard filter only checks how each new connection opens. Once a connection is accepted, its traffic is left alone, so it never interferes with Gepard's encryption or its checks during gameplay.
* **Every Gepard server works the same way.** Gepard uses different keys for each server, and the filter doesn't depend on them, so it works for any Gepard license and version.

**One thing to check before you switch players over:** if your Gepard license is tied to your server's IP address, ask the Gepard developer whether it needs updating for your new Public IP (`104.234.6.142` in this guide). Your backend IP doesn't change, so many setups need nothing at all.

## Ports used by rAthena

| Server                          | Default port | Protocol | ProtoGuard filter                                                                                                 |
| ------------------------------- | ------------ | -------- | ----------------------------------------------------------------------------------------------------------------- |
| Login server                    | 6900         | TCP      | rAthena                                                                                                           |
| Char server                     | 6121         | TCP      | rAthena                                                                                                           |
| Map server                      | 5121         | TCP      | rAthena                                                                                                           |
| rAthena web server (`web_port`) | 8888         | TCP      | rAthena                                                                                                           |
| Website / FluxCP / patcher      | 80, 443      | TCP      | None (or protect it with our [website protection](https://docs.tcpshield.com/miscellaneous/protect-a-website.md)) |
| MySQL / MariaDB                 | 3306         | TCP      | Don't expose it publicly                                                                                          |

Many servers change these ports. Check `conf/login_athena.conf`, `conf/char_athena.conf`, `conf/map_athena.conf` and `conf/web_athena.conf` for the values you use.

Throughout this guide we use the example values from [General Setup](https://docs.tcpshield.com/vxlan/sentry-tunnel-general-setup.md): backend IP `203.0.113.10`, Public IP `104.234.6.142`, VXLAN port `35168`, interface `vxlan_4313`.

## 1. Check the server works directly

Before adding the tunnel, make sure you can log in, select a character and enter the map using your backend IP (`203.0.113.10:6900`). If that doesn't work, fix it first.

## 2. Create the tunnel and run the Setup Script

Follow steps 1–4 of the [General Setup](https://docs.tcpshield.com/vxlan/sentry-tunnel-general-setup.md):

1. Create a tunnel with your backend IP as the endpoint.
2. Open the VXLAN port (UDP `35168`) in your cloud firewall and server firewall.
3. Run the Setup Script and make it persistent with the systemd service.

## 3. Tell rAthena to advertise the Public IP

This is the most important step for Ragnarok. The login server tells the client which IP the char server is on, and the char server tells the client which IP the map server is on. If those still point at your backend IP, players get handed your real IP after logging in, which bypasses the protection.

**`conf/char_athena.conf`** (or `conf/import/char_conf.txt`):

```
// IP the char server uses to reach the login server (keep it local)
login_ip: 127.0.0.1

// IP sent to clients for the char server: your TCPShield Public IP
char_ip: 104.234.6.142
```

**`conf/map_athena.conf`** (or `conf/import/map_conf.txt`):

```
// IP the map server uses to reach the char server (keep it local)
char_ip: 127.0.0.1

// IP sent to clients for the map server: your TCPShield Public IP
map_ip: 104.234.6.142
```

Leave `bind_ip` unset (or `0.0.0.0`) so the servers listen on every interface, including the tunnel.

{% hint style="info" %}
**Keep inter-server links on 127.0.0.1.** The login, char and map servers talk to each other over the inter-server connection. Point those links at `127.0.0.1` (or a private LAN address), not at the Public IP, so they never leave the machine.
{% endhint %}

If you run the servers on separate machines in a private network, check `conf/subnet_athena.conf`. It decides which IP is sent to clients connecting from inside that subnet.

Restart rAthena after editing the configs.

## 4. Update the client

Point the client at the Public IP in your `clientinfo.xml` (or `sclientinfo.xml`, depending on your client):

```xml
<connection>
    <display>My RO Server</display>
    <address>104.234.6.142</address>
    <port>6900</port>
    <version>55</version>
    <langtype>1</langtype>
</connection>
```

If you use a domain in `<address>`, point its A record at the Public IP instead. Rebuild your GRF or patch file and push it through your patcher. Gepard servers can ship this through the Gepard-enabled patcher as usual.

## 5. Lock the backend to the tunnel

Make the login, char and map ports reachable only through the tunnel, so an attacker can't hit your backend IP directly:

```bash
iptables -I INPUT -i lo -j ACCEPT
for port in 6900 6121 5121; do
  iptables -A INPUT -p tcp --dport $port ! -i vxlan_4313 -j DROP
done
```

Or use the UFW approach from General Setup, step 5.

## 6. Enable the rAthena ProtoGuard filter

The rAthena filter recognises login, char, map and web server traffic by itself, so every rAthena port uses the same filter. In the tunnel's **Firewall** tab, add one entry per port:

| Filter Name | Start Port | End Port |
| ----------- | ---------- | -------- |
| rAthena     | 6900       | 6900     |
| rAthena     | 6121       | 6121     |
| rAthena     | 5121       | 5121     |
| rAthena     | 8888       | 8888     |

If your rAthena ports are consecutive (for example 6900–6903), one entry covering the range works too. Don't stretch a range over ports used by other services, such as your website.

The filter checks that the first message on every new connection is a valid rAthena opening message, for every client version (`PACKETVER`) rAthena supports, and bans sources that keep sending junk. After that first message the connection is left alone, so it doesn't interfere with gameplay or with Gepard Shield's encryption.

## 7. Verify

1. Log in through the patched client, select a character and walk around the map.
2. Check that rAthena records the player's real IP, not a TCPShield address. The login-server console shows it on each login, and so does the `loginlog` table:

```sql
SELECT time, ip, user, log FROM loginlog ORDER BY time DESC LIMIT 10;
```

3. Watch the **Analytics** tab while you play. Ingress and egress should both move.

## Troubleshooting

**Players log in, then get stuck on "Connecting to the character server" or freeze when entering the map.** `char_ip` or `map_ip` still points at your backend IP, or at `127.0.0.1`. Set them to the Public IP (step 3) and restart.

**The char or map server can't connect to the login server.** You set `login_ip` (in `char_athena.conf`) or `char_ip` (in `map_athena.conf`) to the Public IP. Those are inter-server addresses. Point them at `127.0.0.1`.

**Gepard Shield reports a license error after moving to the tunnel.** Your Gepard license is probably tied to an IP address. Contact the Gepard developer to update it (see [Gepard Shield support](#gepard-shield-support)).

**Players behind the same internet café or mobile carrier get disconnected.** Many players share one IP in those networks. Check your multi-client limits and per-IP connection settings in rAthena and Gepard.

For tunnel problems (no traffic, firewall, reboots, Pterodactyl), see [Common issues and Debugging](https://docs.tcpshield.com/vxlan/common-issues-and-debugging.md).

## FAQ

**Does Sentry Tunnel work with Gepard Shield?** Yes. Sentry Tunnel and the rAthena ProtoGuard filter are fully compatible with Gepard Shield, with no source patch or Gepard configuration change. See [Gepard Shield support](#gepard-shield-support).

**Do I need to patch rAthena's source code?** No. Sentry Tunnel preserves the real client IP at the network level, so there's no PROXY protocol patch to apply.

**Does this work with Hercules or rAthena forks?** Yes. The tunnel works with any emulator. The `char_ip`/`map_ip` setting names can differ slightly between forks.

**Can I keep my website on the same server?** Yes. Your website stays on your backend IP as before, or you can protect it separately with [Protect a website](https://docs.tcpshield.com/miscellaneous/protect-a-website.md). Don't put the rAthena filter on ports 80 or 443.
