Skip to main content
Run the Hivenet Router router and agents as native Linux binaries managed by systemd. This setup avoids a container runtime and gives you direct control over process supervision, filesystem permissions, logs, resource limits, and upgrades.
This guide uses example hostnames and private IP addresses. Replace them with addresses from your own network.

What you will deploy

The examples use three machines: Applications send requests to the router. Each agent connects its local inference backend to the router.

Network requirements

Restrict ports 50051 and 9000 to agent hosts. Agent hosts initiate their connections to the router and do not need to expose an inbound Hivenet Router port. Keep the metrics endpoint limited to your monitoring network.

Prerequisites

You need:
  • Linux with systemd on the router and agent hosts
  • Go 1.25.5 or later on one build machine
  • Git, OpenSSL, SSH, scp, curl, and jq
  • an inference backend on each agent host
  • an NVIDIA driver on GPU hosts if you want GPU metrics
  • network access between the router and agents
Go is required only to build the binaries. It does not need to be installed on the runtime hosts. This guide uses vLLM as the example backend. Hivenet Router also supports Ollama, SGLang, llama.cpp, Infinity, and custom OpenAI-compatible servers.

Build the binaries

On the build machine:
Check that both binaries start:

Prepare the runtime hosts

Create a dedicated service account and directories before copying the binaries.

Router host

On router-server:
If the account already exists, useradd will report an error that you can ignore. Create the required directories:

Agent hosts

Run these commands on each inference host:
Create the required directories:
On GPU hosts, add the service account to the video group so it can access NVIDIA device metrics:
If your distribution uses a separate render group for device access, add that group as well:

Install the binaries

Copy the router binary to the router host through a temporary location:
On router-server:
Copy the agent binary to each inference host:
On each inference host:
Keeping the binaries owned by root prevents the service account from replacing its own executable.

Create and distribute the JWT secret

The router and every agent must use the same JWT secret. On the build machine:
Copy the secret to a temporary path on every host:
On each host, install it with permissions that allow the Hivenet Router service to read it:
Delete the local copy from the build machine when you no longer need it:
Anyone with this secret can authenticate an agent with the router. Use your normal secrets-management and rotation process in production.

Start an inference backend

Run an inference backend on each agent host. For vLLM:
Check that the backend is ready:
A ready vLLM server returns HTTP status 200. The Hivenet Router agent runs as a long-lived daemon. It can start before the backend is ready and will continue polling until it becomes available. If the backend or router later becomes unavailable, the agent waits and reconnects rather than exiting on the first transient failure.

Configure the router service

Create:
with the following content:
The --p2p-listen-addr 0.0.0.0 setting is required when agents connect from other machines. The router defaults to listening on 127.0.0.1.
HIVENET_ROUTER_ALLOW_INSECURE_ADMIN=true permits unauthenticated access to /admin/* in this example. Replace it with administrator API-key authentication before exposing the router to shared or untrusted networks.
The built-in HTTP API does not terminate client-facing TLS. Put the router behind a reverse proxy or load balancer that provides HTTPS before exposing it outside a trusted network.

Configure the first agent

Create a host-specific environment file on gpu-eu-1:
with:
Protect the file:
Create:
with:
If the video group does not exist on your host, remove the SupplementaryGroups=video line. If your NVIDIA device permissions use another group, add that group instead.
The important multi-machine settings are:

Configure the second agent

Install the same systemd service file on gpu-eu-2. Create /etc/hivenet-router/agent.env with host-specific values:
Protect it:
The service file itself does not need to change between hosts.

Start the services

On router-server:
Check its status:
On each agent host:
Check the agent:

Verify the deployment

On the router host, check the public liveness endpoint:
Expected response:
Check the operational health endpoint:
With both agents registered, the response should resemble:
Peer IDs and timestamps will differ. For a fuller view of routing, latency, hardware, and engine state:

Send an inference request

From a machine that can reach the router:
The router selects one of the agents serving the requested model and forwards the request to its local backend. Client authentication is disabled when no auth configuration is provided. Add API-key authentication before exposing the service beyond a trusted environment.

Add another agent host

You do not need to restart the router when adding capacity. On the new host:
  1. Create the hivenet-router account and directories.
  2. Install the agent binary.
  3. Install the shared JWT secret.
  4. Create /etc/hivenet-router/agent.env with the router address and agent region.
  5. Install the agent systemd unit.
  6. Start the inference backend.
  7. Enable and start hivenet-agent.
The new agent registers automatically once it can reach the router and its backend is ready.

Upgrade Hivenet Router

Build the new binaries on the build machine:

Upgrade agents

When several agents serve the same model, upgrade them one at a time to preserve capacity. Copy the new agent binary:
On the agent host:
Confirm that the agent registers again before upgrading the next host.

Upgrade the router

Copy the new binary:
On the router host:
Check the health endpoint before returning traffic:

Roll back

To restore the previous router binary:
Use the equivalent commands with hivenet-agent on an agent host.

Run an agent behind NAT

Agents initiate both authentication and libp2p connectivity to the router. An agent behind NAT therefore does not need an inbound port, reverse tunnel, or public announce address. The agent host needs outbound access to:
When the router itself is behind NAT or another translated network, configure the router’s --p2p-announce-addr with a multiaddress the agent can reach.

Troubleshooting

A service does not start

Inspect its status and recent logs:
For an agent:

The router cannot read the JWT secret

Check the file ownership and mode:
Expected ownership and permissions:
Test access as the service account:

An agent does not register

From the agent host, check the router:
Common causes include:
  • the router is not listening on 0.0.0.0
  • ROUTER_IP is incorrect
  • the router advertises a libp2p address the agent cannot reach
  • the router needs a correct --p2p-announce-addr behind NAT or port translation
  • the router or agent firewall blocks outbound agent connectivity
  • the JWT secret differs between hosts
  • the backend has not become healthy
  • the agent environment file contains an invalid value

The agent gets a new peer ID after restart

Confirm that the persistent identity file exists:
The service account must be able to read and write this file.

GPU metrics are missing

Check NVIDIA access:
Test access as the service account:
Check the account’s groups:
If necessary:
If NVML remains unavailable, the agent continues to report CPU and memory metrics but omits GPU metrics.

Ports are already in use

Check live routing data

Check the routing counter:

Next steps

vLLM agent

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

Configuration reference

Review every router and agent flag and environment variable.

Authentication overview

Protect the client and administration APIs before production use.