MarchSnow's Blog

How to Run a CS2 Server on an IPv6-Only VPS

Word count: 1kReading time: 6 min
2026/05/26
loading

Introduction

More and more cloud providers are offering IPv6-only VPS plans or adding IPv6 addresses to their servers. The reason is straightforward: IPv4 addresses are exhausted, while IPv6 resources are plentiful and significantly cheaper

IPv6-only VPS instances are typically very affordable, making them an attractive option for hosting private game servers

Meanwhile, a server tucked behind an IPv6 address is far less susceptible to DDoS attacks

The reality, however, is that the vast majority of game servers do not natively support pure IPv6 connections — and CS2 is no exception

That’s why I built PortRelay — a lightweight port relay tool

With it, you can run a CS2 server on an IPv6-only VPS and let completely unmodified CS2 clients connect over IPv6 without any extra configuration

Architecture Overview

The core idea is simple: the CS2 server listens only on the local loopback address, while PortRelay-Server handles the public-facing IPv6 endpoint

On the player’s machine, PortRelay-Client runs locally, simulating a CS2 server address — all traffic is forwarded through an IPv6 tunnel

1
2
3
4
5
6
7
8
9
10
11
12
13
CS2 Client

↓ connect 127.0.0.1:27015

PortRelay-Client (local machine)

↓ IPv6 tunnel encapsulation

PortRelay-Server (VPS [::]:9000)

↓ decapsulate & forward

CS2 Server (VPS 127.0.0.1:27015)
Component Location Description
CS2 Server IPv6-only VPS Listens only on 127.0.0.1:27015, never exposed to the public
PortRelay-Server Same VPS Listens on [::]:9000, forwards tunnel traffic to the local CS2
PortRelay-Client Player’s machine Listens on 127.0.0.1:27015, establishes an IPv6 tunnel to the server

Prerequisites

  • An IPv6-only VPS to run the CS2 server and PortRelay-Server
  • IPv6 network access on the player’s machine

Step 1: Deploy the CS2 Server on the VPS

We won’t walk through the standard CS2 dedicated server installation here. Just make sure of two things:

  1. The CS2 server binary is installed and starts correctly on your VPS
  2. Add -ip 127.0.0.1 to the startup parameters so it listens only on the loopback address, never directly exposed to the public

Step 2: Deploy PortRelay-Server on the VPS

2.1 Download

Grab the latest release for your platform from Releases and extract it to any directory

You can also fork the source and build it yourself (requires Go 1.24+)

2.2 Configure PortRelay-Server

Create server.json:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"name": "CS2-Tunnel Server",
"mode": "server",
"admin_passwd": "",
"listen_port": "9000",
"listen_protocol": "all",
"proxies": [
{
"name": "cs2-tunnel",
"type": "tunnel",
"service_target": "127.0.0.1:27015",
"allow_protocol": "all",
"passwd": "your-password"
}
]
}

Key fields:

Field Value Description
listen_port 9000 Public listening port, awaits client connections
listen_protocol all Accept both TCP and UDP connections
service_target 127.0.0.1:27015 Forward target: the local CS2 server
passwd your choice Clients must present the same password

2.3 Start PortRelay-Server

1
2
# Foreground (testing)
./portrelay --config server.json

When the server starts successfully, you should see logs similar to:

1
2
3
4
5
6
7
8
9
10
11
User@LinuxServer:~/portrelay$ ./portrelay-linux-amd64
2026/05/26 21:10:19 PortRelay starting: name="CS2-Tunnel Server" mode=server proxies=1
2026/05/26 21:10:19 [Server] TCP listener started on :9000
2026/05/26 21:10:19 [Server] UDP listener started on :9000
2026/05/26 21:10:19 [Server] ========================================
2026/05/26 21:10:19 [Server] Config : "CS2-Tunnel Server"
2026/05/26 21:10:19 [Server] Listen port : 9000
2026/05/26 21:10:19 [Server] Transport : all
2026/05/26 21:10:19 [Server] Tunnels : 1
2026/05/26 21:10:19 [Server] - "cs2-tunnel" → 127.0.0.1:27015 (inner: all)
2026/05/26 21:10:19 [Server] ========================================

Once confirmed working, consider setting it up as a systemd service for automatic restart on boot

Step 3: Configure PortRelay-Client on the Player’s Machine

3.1 Download

Download the version for your operating system from Releases

3.2 Create the Configuration File

Create client.json:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"name": "CS2-Tunnel Client",
"mode": "client",
"proxies": [
{
"name": "cs2-tunnel",
"type": "tunnel",
"listen_protocol": "all",
"listen_local": "127.0.0.1:27015",
"server_ip": "[YOUR_VPS_IPv6_ADDRESS]:9000",
"server_passwd": "your-password",
"transport": "auto"
}
]
}
Field Value Description
listen_local 127.0.0.1:27015 Local listen address — CS2 connects here
server_ip [VPS IPv6]:9000 Server’s IPv6 address and port
server_passwd your choice Must match the server-side configuration
transport auto Automatic transport protocol selection

3.3 Start PortRelay-Client

1
./portrelay --config client.json

A Connected log entry means the tunnel is established:

1
2
2026/05/26 21:18:03 [Tunnel "cs2-tunnel"] Connected | server=[IPv6-Address]:9000 | transport=UDP | listen=all
2026/05/26 21:22:48 [Tunnel "cs2-tunnel"] New session | id=someid | mode=UDP-in-UDP | from=127.0.0.1:62769

Keep this process running (or set it up as a background service)

Step 4: Connect to the Server

Launch CS2, open the developer console with ~, and enter:

1
connect 127.0.0.1:27015

CS2 sends traffic to the local PortRelay-Client, which forwards it through the IPv6 tunnel to the CS2 server on your VPS. The player never needs to be aware of any intermediate layers

Summary

PortRelay goes beyond this demo. In addition to the IPv6-over-IPv4 scenario covered here, it also supports:

  • Encapsulating UDP traffic inside a TCP tunnel (or vice versa), improving connectivity in restricted network environments
  • Accepting configuration via Base64-encoded JSON passed directly as a CLI argument, making it easy to integrate with third-party programs or wrap in custom scripts
  • Embedding into custom clients to take advantage of cheap IPv6 resources while shielding your server from DDoS attacks

If you have any questions or suggestions, feel free to open an issue on GitHub

Author: MarchSnow

Link: https://blog.88889000.xyz/2026/tech/cs2-server-on-ipv6-only-vps/

Publish date: May 26th 2026, 21:03:25 UTC

Update date: May 26th 2026, 13:59:02 UTC

Page Views: --

License: Licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

CATALOG
  1. 1. Introduction
  2. 2. Architecture Overview
  3. 3. Prerequisites
  4. 4. Step 1: Deploy the CS2 Server on the VPS
  5. 5. Step 2: Deploy PortRelay-Server on the VPS
    1. 5.1. 2.1 Download
    2. 5.2. 2.2 Configure PortRelay-Server
    3. 5.3. 2.3 Start PortRelay-Server
  6. 6. Step 3: Configure PortRelay-Client on the Player’s Machine
    1. 6.1. 3.1 Download
    2. 6.2. 3.2 Create the Configuration File
    3. 6.3. 3.3 Start PortRelay-Client
  7. 7. Step 4: Connect to the Server
  8. 8. Summary