Skip to main content
Deploy one Hivenet Router router and two vLLM agents across three Linux machines. The router receives application requests through one client-facing API. Each agent connects a vLLM backend to the router. Both agents serve the same model, allowing Hivenet Router to distribute requests between them.
The hostnames and private IP addresses in this guide are examples. Replace them with addresses from your own network.

What you will deploy

Applications send requests to the router on port 8080. Agents authenticate with the router over gRPC, receive the router’s libp2p connection details, and initiate the persistent connection used for registration and inference traffic.

Network requirements

Agent hosts initiate their connections to the router and do not need to expose an inbound Hivenet Router port. Keep the Prometheus endpoint restricted to your monitoring network.

Prerequisites

You need:
  • three Ubuntu or Debian machines
  • Docker 20.10 or later on the router
  • Docker Compose 2.0 or later
  • an NVIDIA driver on each GPU machine
  • Git, OpenSSL, curl, jq, and scp
  • network access between the hosts on the ports listed above
  • access to the model used in this guide
This guide uses Docker host networking and is intended for Linux hosts.
1

Prepare the router

On router-server, clone the repository:
Make sure Docker is installed and running:
Build the router image:
Create the persistent database directory:
2

Prepare the GPU hosts

Run these steps on both gpu-eu-1 and gpu-eu-2.Clone the repository:
Run the agent-host setup script:
The script:
  • verifies that the NVIDIA driver is available
  • installs Docker and the Docker Compose plugin when needed
  • installs and configures the NVIDIA Container Toolkit
  • checks that containers can access the GPU
  • verifies outbound connectivity requirements for the agent host
  • installs host packages used by inference engines that compile native extensions
If the script adds your user to the Docker group, sign out and back in before running Docker without sudo.Build the agent image:
Create a directory for the shared secret and persistent agent identity:
3

Create and distribute the shared secret

On router-server, from the repository root:
Copy the secret to both agent hosts:
On each agent host, restrict access to the file:
The router and every agent must use the same JWT secret. Anyone with this secret can authenticate an agent with the router. Use your normal secret-management process in production.
4

Start the router

On router-server, from the repository root:
The router uses host networking so its HTTP, gRPC, libp2p, and metrics interfaces bind directly to the machine.
HIVENET_ROUTER_ALLOW_INSECURE_ADMIN=true permits unauthenticated access to /admin/* for this quickstart. Configure administrator API-key authentication before exposing the router to shared or untrusted networks.
Check the public liveness endpoint:
Expected response:
Check the operational health endpoint:
Before any agents register, the response should report zero agents:
The full response also contains a Unix timestamp.
If the router is behind NAT, Docker port mapping, or a public hostname, configure --p2p-announce-addr with an address the agents can reach.
5

Start vLLM on the first GPU host

On gpu-eu-1:
Wait for the model to load:
Check the backend health endpoint:
A ready vLLM server returns HTTP status 200.
6

Start the first agent

On gpu-eu-1:
The declared capacity matches the vLLM --max-num-seqs value used in this example.Check the agent logs:
The agent waits for the backend to become healthy, discovers the model through GET /v1/models, authenticates with the router, and registers.These flags are important in a multi-machine Docker deployment:
7

Start vLLM and the agent on the second GPU host

On gpu-eu-2, start the second vLLM backend:
Wait for the backend to become healthy:
Then start the second agent:
8

Verify agent registration

On router-server:
With both agents healthy, the response should resemble:
Peer IDs and timestamps will differ.For a fuller view of routing, latency, hardware, and engine state:
9

Send an inference request

From a machine that can reach the router:
The router selects one of the two agents serving the model and forwards the request to its local vLLM backend.Client authentication is disabled by default when no auth configuration is provided. To require API keys, configure the router with an auth file and include an authorization header in requests.
See API keys for the complete setup.
10

Observe load distribution

Send ten requests in parallel:
Inspect the routing counter:

Port reference

Because the agent container uses host networking, it reaches vLLM at localhost:8888. The backend port does not need to be exposed outside the GPU machine.

Troubleshooting

An agent does not register

Check the agent logs:
Test the agent’s connection to the router:
Common causes include:
  • --router-grpc points to the wrong address
  • the router advertises a libp2p address the agent cannot reach
  • the router is not listening on 0.0.0.0
  • the backend is not healthy
  • the router and agent use different JWT secrets

vLLM is not ready

Inspect the logs:
Check the health endpoint:
Wait for vLLM to finish loading the model before starting the agent.

The JWT secret does not match

On the router and each agent host:
The hash must be identical on every host.

GPU metrics are missing

Check that Docker can access the GPU:
Confirm that the agent container received a GPU device request:

A firewall blocks traffic

On the router, allow only the traffic your deployment requires. With UFW:
These commands are examples, not a complete network-security policy. Apply equivalent restrictions in your cloud firewall or security group.

Clean up

On each agent host:
On the router:
The BadgerDB data in the mounted badger directory and agent identity files in /opt/hivenet-router remain after the containers are removed.

Next steps

Docker Compose

Add Prometheus, Grafana, Loki, and Tempo using the repository’s Compose stack.

vLLM agent

Configure model discovery, metrics, capacity, and multi-model deployments.

Routing concepts

Control how Hivenet Router filters, ranks, and falls back across agents.