Server-side implementation for vnt-compatible networking, with support for:
- TCP over TLS
- WebSocket Secure (WSS)
- QUIC
- Optional web management UI/API
- Optional persistence with SQLite
- Optional peer-to-peer server federation
The server reads config.toml from its current working directory by default.
- If
config.tomldoes not exist, the server will generate one automatically using built-in defaults. - In Docker, the working directory is
/app/data, so the effective config path is/app/data/config.toml. - You can also pass a custom config path with
--conf /path/to/config.toml.
The repository includes a sample file at data/config.example.toml.
tcp_bind
- TCP listener address for control traffic over TLS.
- Example:
0.0.0.0:29872 - Remove this field to disable the TCP listener.
quic_bind
- QUIC listener address for control traffic.
- Example:
0.0.0.0:29872 - Remove this field to disable QUIC.
ws_bind
- WSS listener address.
- Example:
0.0.0.0:29872 - Remove this field to disable WSS.
network
- Default virtual network CIDR used by the server.
- Example:
10.26.0.0/24
custom_nets
- Additional named virtual networks.
- TOML table format:
[custom_nets]
office = "10.27.0.0/24"
lab = "10.28.0.0/24"white_list
- List of allowed network codes.
- Empty list means no whitelist restriction.
lease_duration
- Device IP lease duration in seconds.
- Example:
86400for 24 hours.
web_bind
- Bind address for the web management UI and HTTP API.
- Example:
0.0.0.0:29871 - Remove this field to disable the web UI/API.
username
- Username for the web management login.
password
- Password for the web management login.
persistence
- Enables persistence in SQLite.
- When enabled, the server stores networks, devices, and peer-server records in
network_control.db.
cert
- Path to a PEM certificate file.
- If both
certandkeyare omitted, the server will generatecert.pemautomatically.
key
- Path to a PEM private key file.
- If both
certandkeyare omitted, the server will generatekey.pemautomatically.
server_quic_bind
- Optional QUIC bind address for server-to-server federation.
- Example:
0.0.0.0:29873
peer_servers
- List of upstream or sibling server addresses for federation.
- Example:
peer_servers = ["server1.example.com:29873", "192.168.1.10:29873"]server_token
- Shared token used for inter-server authentication.
- Set this when
server_quic_bindorpeer_serversis enabled.
The server writes several files relative to its working directory:
config.tomlnetwork_control.dbcert.pemkey.pemlogs/logs/log4rs.yaml
If you use Docker, all of these should be stored in a mounted directory so they survive container recreation.
- If
tcp_bindandws_binduse the same address, the server will multiplex TLS TCP and WSS on that single port. - If
persistence = false, runtime state is not stored in SQLite. - Certificate paths may be absolute or relative. Relative paths are resolved from the process working directory.
The repository already includes:
Dockerfiledocker-compose.ymlrust-toolchain.toml
This project uses Rust 2024 edition syntax. To avoid syntax and toolchain mismatches across environments, the build is pinned to Rust 1.93.1 in both:
rust-toolchain.toml- Docker build arg
RUST_VERSION
This is newer than the minimum required stable version and avoids edition-related compatibility problems.
In Docker, the container runs with:
- working directory:
/app/data
The compose file mounts:
- host
./data - to container
/app/data
That means the following files will persist on the host:
./data/config.toml./data/network_control.db./data/cert.pem./data/key.pem./data/logs/...
- Copy the sample config:
cp data/config.example.toml data/config.toml-
Edit
data/config.tomlas needed. -
Build and start the service:
docker compose up -d --build- Check logs:
docker compose logs -f- Stop the service:
docker compose down29871/tcp: web UI / HTTP API29872/tcp: TLS TCP control traffic29872/udp: QUIC control traffic29873/udp: optional peer-server QUIC federation
If you do not use the web UI or peer federation, you may remove the corresponding published ports in docker-compose.yml.
If you want the server to generate its own default config and certificates:
- Create the data directory:
mkdir -p data- Start the container:
docker compose up -d --build- After the first start, inspect the generated files in
./data.
This is convenient for initial setup, but for controlled deployments it is better to create data/config.toml explicitly from data/config.example.toml.
When the source code changes:
docker compose up -d --buildBecause all persistent state is stored in ./data, recreating the container does not remove the database, config, certificates, or logs.
Build:
docker build -t vnts2:local .Run:
docker run -d \
--name vnts2 \
-p 29871:29871/tcp \
-p 29872:29872/tcp \
-p 29872:29872/udp \
-p 29873:29873/udp \
-v "$(pwd)/data:/app/data" \
--restart unless-stopped \
vnts2:localIf the container starts but no service is reachable:
- Check whether the listener is enabled in
config.toml. - Check whether the port mapping matches the bind addresses in the config.
- Check
docker compose logs -f.
If the database is not persistent:
- Confirm
persistence = true. - Confirm
./datais mounted to/app/data. - Confirm the server is actually using the expected working directory.
If TLS files are missing:
- The server only auto-generates
cert.pemandkey.pemwhen customcertandkeyare not provided. - Generated files are written into the working directory, which is
/app/datain Docker.