The hostnames and private IP addresses in this guide are examples. Replace them with addresses from your own network.
What you will deploy
This example uses four machines:
The router exposes one client-facing API to applications. Each agent connects an inference backend to the router.
Network requirements
The machines must be able to communicate over these ports:
Agent hosts need outbound access to the router’s gRPC and libp2p ports. They do not need to expose an inbound Hivenet Router port. Keep the Prometheus endpoint limited to your monitoring network.
Prerequisites
You need:- Go 1.25.5 or later on one build machine
- Git
- OpenSSL
- SSH and
scp curljqfor formatting JSON responses- vLLM installed on the two vLLM hosts
- Ollama installed, or permission to install it, on the Ollama host
- access to the models used in this example
Prepare the target machines
On each router and agent machine, create the Hivenet Router directory:router-servergpu-eu-1gpu-eu-2gpu-us-1
Build and distribute Hivenet Router
On the build machine:Create the shared JWT secret
The router and every agent must use the same JWT secret. On the build machine:Start the vLLM backends
Run the following command on bothgpu-eu-1 and gpu-eu-2:
200.
Start the Ollama backend
Ongpu-us-1, install Ollama if it is not already installed:
200 and a list containing llama3.1:8b.
Start the router
Onrouter-server, prepare the persistent database directory:
--p2p-listen-addr 0.0.0.0 flag allows agents on other machines to reach the router’s libp2p endpoint.
Check the public liveness endpoint:
If the router runs behind NAT, inside Docker, or behind a public hostname, you may also need
--p2p-announce-addr so agents receive a reachable router address.Start the first vLLM agent
Ongpu-eu-1:
Start the second vLLM agent
Ongpu-eu-2:
Start the Ollama agent
Ongpu-us-1:
5. Set capacity according to the concurrency your backend can handle.
For a multi-machine deployment, these two agent settings are particularly important:
Agents initiate the connection to the router. You do not need to expose an inbound agent port or configure an agent announce address.
The agent waits until its backend is healthy and a model is available before registering. If you do not pass
--model, it registers the first model returned by the backend.
Each agent registers one model.
Verify agent registration
Onrouter-server:
Send an inference request
From any machine that can reach the router:Observe load distribution
Send ten requests in parallel:Troubleshooting
The router gRPC endpoint is unreachable
Onrouter-server, check that the port is listening:
An agent does not register
Check for these common causes:--router-grpcpoints to the wrong or unreachable address- the router is still listening for libp2p only on
127.0.0.1 - the router advertises a libp2p address the agent cannot reach
- the router needs a correct
--p2p-announce-addr - the inference backend is not ready
- the router and agent use different JWT secrets
A backend is not ready
Check vLLM:The JWT secret does not match
Confirm that every machine has the same secret:A firewall blocks the connection
The exact commands depend on your firewall. With UFW, a basic router configuration could look like:50051 and 9000.

