Skip to content

Trusted network: what qix listens on, and what it trusts

qix has no authentication, no authorization and no transport encryption of its own. It trusts every process that can reach one of its sockets. This page lists those sockets, says where each one binds by default, and lists the known exposures. Read it before you open any qix port to a network you do not control.

Terms used on this page:

  • Rank: one python -m tnd.serve process. It holds one share of the model on its GPU(s).
  • Copy: one rank (or one lockstep group of ranks) that serves requests on its own. Several copies on one host sit behind the node router.
  • Node router: tnd-node-router, the C++ front end that qix-serve starts when it runs more than one rank on a host. It forwards requests to the copies.
  • Rank 0: the first rank of a tensor-parallel or expert-parallel group. The other ranks of the group connect to it.
  • Port family: the ports one group of ranks uses, counted from that group's MASTER_PORT.
  • Packaged build: an install made from a qix .deb package, with its systemd units and launch scripts. That packaging is not in the open source tree. A passage marked "packaged build only" does not apply to a build from source or to a pip install.

The short version

  • Every HTTP listener binds 127.0.0.1 unless you pass --host.
  • The rank-to-rank sockets that qix opens bind MASTER_ADDR, which defaults to 127.0.0.1.
  • One rank-to-rank socket is opened by torch, not by qix. Torch decides where it listens, on one host too (see "Sockets that ignore MASTER_ADDR").
  • qix-serve starts every group of ranks on one host. A group that spans hosts is not part of the open engine (not-included.md).
  • Put an authenticating proxy (for example nginx or Envoy with your own auth) in front of any HTTP listener that is not on loopback. qix does not check who sent a request.

HTTP: the OpenAI-compatible API

Where it listens

Launch path Default bind Where the default is set
python -m tnd.serve 127.0.0.1 python/tnd/serve.py:1673 (--host, default 127.0.0.1)
qix-serve with one rank 127.0.0.1 python/tnd/serve.py:1673: qix-serve runs the rank with the operator's arguments and adds no --host (csrc/serve_auto/tnd_serve_main.cpp:405-412)
qix-serve with several ranks node router on --host, default 127.0.0.1 csrc/serve_auto/tnd_serve_main.cpp:418
tnd-node-router run by hand 127.0.0.1 csrc/distributed/node_router.h:326
python -m tnd.router 127.0.0.1 python/tnd/router.py:358 (--host, default 127.0.0.1)
python -m tnd.dp_router 127.0.0.1 python/tnd/dp_router.py:600 (--host, default 127.0.0.1)

When qix-serve runs several ranks, each rank's own HTTP port binds 127.0.0.1 (csrc/serve_auto/launch.cpp:241). The rank ports start at --port + 10000 (csrc/serve_auto/tnd_serve_main.cpp:425). Only the node router listens on the address you chose (csrc/serve_auto/launch.cpp:282).

qix-serve and tnd-node-router print one line at start-up when they listen on loopback only (csrc/serve_auto/tnd_serve_main.cpp:400-403, csrc/distributed/node_router_main.cpp:237-238). That line says how to listen on every interface. A rank started as python -m tnd.serve with no qix-serve on the machine prints no such line.

Packaged build only. The systemd unit tnd-server reads TND_HOST from /etc/tnd-server/tnd-server.conf; the shipped value is 127.0.0.1. The launch scripts tnd-serve-tp-launch (a tensor-parallel group) and tnd-serve-copy-launch also default to 127.0.0.1. Each adds its own --host only when you passed none, so a --host you pass always wins.

How to listen on every interface

Pass --host 0.0.0.0:

qix-serve --model <MODEL> --host 0.0.0.0 --port 8000

Packaged build only. For the systemd unit, set TND_HOST=0.0.0.0 in /etc/tnd-server/tnd-server.conf.

vLLM listens on every interface by default. qix does not. A script written for vLLM that relies on that default needs --host 0.0.0.0 added to reach qix from another host.

What listening on every interface exposes

Everything on the listener is open to anyone who can reach the port. There is no API key check.

A rank's listener has 10 routes, declared in one table (csrc/server/http_server.cpp:333-346):

Route Method What it does Handler at
/v1/chat/completions POST generate csrc/server/http_server.cpp:1198
/v1/completions POST generate csrc/server/http_server.cpp:1733
/v1/models GET the served model id csrc/server/http_server.cpp:1192
/health GET liveness; 503 while the rank drains or sleeps csrc/server/http_server.cpp:1035
/metrics GET Prometheus text; see metrics.md csrc/server/http_server.cpp:1182
/tnd/window_stats GET token counters since start (request count, input, cached and output tokens, a prompt-length histogram) csrc/server/http_server.cpp:1126
/tnd/reset_prefix_cache POST drops every cached prefix that no request holds csrc/server/http_server.cpp:1149
/sleep POST stops serving and frees the rank's GPU memory csrc/server/http_server.cpp:1081
/wake_up POST restores the memory and serves again csrc/server/http_server.cpp:1094
/is_sleeping GET the rank's sleep state csrc/server/http_server.cpp:1108

The two /tnd/* admin routes and /metrics share the listener with the API. None of them checks who called. Anyone who can reach the port can empty the prefix cache, which makes the following requests recompute their prompts.

The three sleep routes check one thing: the address of the peer's socket. They answer a peer on 127.0.0.0/8, ::1 or ::ffff:127.x.y.z and refuse any other peer with 403 (csrc/server/sleep_control.cpp:25-44). Two limits of that check:

  • It is a peer-address check, not authentication. A reverse proxy on the same host is a loopback peer. So the routes also refuse, with 403, a loopback request that carries a Forwarded, X-Forwarded-For or X-Real-IP header: a proxy relayed it (csrc/server/http_server.cpp sleep_relay_header, #1090). nginx adds X-Forwarded-For only when its config says so; a same-host proxy that forwards /sleep without any of these headers still looks like a local process, and any client of that proxy can put the rank to sleep. Do not forward the three routes.
  • --sleep-remote on tnd.serve turns both checks off (python/tnd/serve.py, --sleep-remote). Any peer that reaches the port, and any proxy that relays to it, can then sleep and wake the rank.

A sleeping rank answers every inference request with 503 (operations.md).

On the node router's listener (csrc/distributed/node_router.cpp), only five routes exist: /v1/chat/completions, /v1/completions, /health, /v1/models and /metrics. They are declared in one table, kRouterRoutes in csrc/distributed/node_router.cpp. The router does not forward /tnd/* or the sleep routes. In a multi-rank launch those routes are therefore only on the rank ports, which bind 127.0.0.1.

When an admission identity plugin is loaded (plugins.md), it sees every request on all 10 rank routes before the handler runs, and may refuse it. On the sleep routes its check runs first and the loopback rule runs after it. With no such plugin, nothing checks the caller.

Node router and the identity plugin

qix-serve hands the same plugin file to the ranks and to the node router. The router loads the identity stage of ADMISSION from it, and only that stage: quota and capacity stay in the ranks. With an identity provider loaded:

  • The router asks it on all five of its routes before the handler runs. A refusal is answered by the router, and the request never reaches a copy.
  • On the two inference routes the router calls it twice, before and after it reads the body (the second call carries the model), under the router's own request id. release comes once per request. Its usage carries no token counts: the router does not count tokens. The copy's own identity stage sees the request again, under the copy's id, and its release carries the counts.
  • A proxied request (the two inference routes, and the /v1/models and /metrics calls the router makes on a client's behalf) carries the client's headers to the copy, so the copy's identity stage sees the same credential. Hop-by-hop headers, Host, Content-Length, Content-Type and Accept-Encoding are not passed on. The client's own Forwarded, X-Forwarded-For and X-Real-IP are dropped too, and the router sets X-Forwarded-For to the peer address its socket saw (end_to_end_headers), so a provider on the copy can read the client address from that header. With no identity provider the router passes on Authorization, Accept, x-session-id and the deadline header only, as before.

The router's health probe carries no credential. Every --health-interval seconds the router sends GET /health to each copy, with no client behind it. The plugin ABI (include/tnd/plugin/admission.h) gives the router no credential of its own for such internal calls. An identity provider in the ranks must therefore admit TND_ROUTE_HEALTH from the router's peer address, which is loopback when qix-serve started the copies. A provider that refuses it makes every copy read DOWN, and the router answers 503 until the probe passes.

Rank-to-rank sockets

A group of ranks (tensor parallel or expert parallel) talks over TCP. Rank 0 opens the listeners; the other ranks connect to MASTER_ADDR. Four listeners take their port from MASTER_PORT (default 29500):

Listener Port Override Source
expert-parallel NCCL bootstrap MASTER_PORT + 1 (default 29501) TND_EP_BOOTSTRAP_PORT csrc/distributed/ep_nccl.cpp:68-83, bind at csrc/distributed/rank_id_rendezvous.cpp:93
expert-parallel convoy coordinator MASTER_PORT + 2 (default 29502) TND_EP_CONVOY_PORT csrc/distributed/convoy_coordinator.cpp:230-242, bind at csrc/distributed/convoy_coordinator.cpp:254
tensor-parallel NCCL bootstrap MASTER_PORT + 3 (default 29503) TND_TP_NCCL_PORT csrc/distributed/tp_nccl.cpp:54-64, bind at csrc/distributed/rank_id_rendezvous.cpp:93
tensor-parallel batch channel MASTER_PORT + 4 (default 29504) TND_TP_BATCH_PORT csrc/distributed/tp_batch_channel.cpp:442-454, bind at csrc/distributed/tp_batch_channel.cpp:466

These sockets carry no authentication and no encryption.

Port families

qix-serve gives each expert-parallel group, or each copy, its own MASTER_PORT. The families are 10 ports apart (csrc/serve_auto/launch.cpp:236-246): the first is the base port, the second is base + 10, and so on. The base is TND_SERVE_MASTER_PORT, else MASTER_PORT, else 29500 (csrc/serve_auto/tnd_serve_main.cpp:427-428). With the default base, the first family's ports are 29501 to 29504 and the second family's are 29511 to 29514. An expert-parallel group listens on +1, +2 and the torch-owned +3 (below). A tensor-parallel group listens on +3 and +4.

An override such as TND_EP_BOOTSTRAP_PORT is one port number. Every rank that inherits it uses that port, whatever its family.

Which address they bind

All four call bind_rank_listener (csrc/distributed/rank_bind.h:219). It binds the address the other ranks dial:

  • MASTER_ADDR unset or empty: 127.0.0.1.
  • MASTER_ADDR=0.0.0.0: every interface. You asked for it by name.
  • a numeric IPv4 address: that address.
  • a host name: one IPv4 address of that name. A loopback name takes its first address; any other name takes its numerically lowest non-loopback address, so every rank picks the same one. When the name has more than one such address, rank 0 prints the one it bound.

Two cases stop start-up instead of opening a socket you did not ask for:

  • MASTER_ADDR does not resolve. The bind fails, the log line names MASTER_ADDR, and the rank exits (csrc/distributed/rank_bind.h:227-236).
  • A name that is not a loopback name resolves only to loopback addresses (for example a host name mapped to 127.0.1.1 in /etc/hosts). The bind fails the same way.

One case falls back to every interface, and prints a line that says so:

  • the bind returns EADDRNOTAVAIL, which means MASTER_ADDR is not an address of this host. This happens with a cloud public address that NAT maps onto a private interface. Rank 0 then listens on 0.0.0.0 (csrc/distributed/rank_bind.h:247-258).

When qix-serve starts an expert-parallel group on one host, it sets MASTER_ADDR=127.0.0.1 for each rank (csrc/serve_auto/launch.cpp:257). The four listeners above then stay on loopback. The torch-owned socket below does not follow that setting.

Sockets that ignore MASTER_ADDR

Some sockets are opened by torch, gloo and NCCL, not by qix. qix gives them an address to dial, not an address to bind. The binding rules below are those libraries' own. Nobody has checked them with ss on a running node, so treat them as unmeasured.

Socket Opened by What it binds
torch's TCPStore torch.distributed.init_process_group on rank 0, when the expert-parallel exchange starts its gloo group with init_method="tcp://MASTER_ADDR:PORT" (python/tnd/_ep_runner.py:697-700); the NCCL group of the DeepEP exchange does the same (python/tnd/_ep_runner.py:716-719) port MASTER_PORT + 3 (TND_EP_A2A_PORT overrides), on the address torch chooses. Torch's store server takes a port, not an address, so expect every interface. MASTER_ADDR is only the address the peers dial.
gloo data sockets the gloo process group one listener per rank on a port the kernel picks, on the interface gloo chooses (GLOO_SOCKET_IFNAME selects it)
NCCL data sockets NCCL, for its own bootstrap ring and its socket transport ports the kernel picks, on the interface NCCL chooses (NCCL_SOCKET_IFNAME selects it)

So an expert-parallel group on one host, with MASTER_ADDR=127.0.0.1, still has the TCPStore on MASTER_PORT + 3 outside qix's bind rule, and gloo and NCCL may listen on an interface that is not loopback. A firewall, or a host with no untrusted neighbour, is what keeps them private. qix cannot bind them to loopback from its own code.

A shared default port

MASTER_PORT + 3 is the default of two listeners:

  • the tensor-parallel NCCL bootstrap (csrc/distributed/tp_nccl.cpp:54-64, override TND_TP_NCCL_PORT);
  • the expert-parallel exchange group's TCPStore (python/tnd/_ep_runner.py:651-652, python/tnd/_ep_runner.py:698, override TND_EP_A2A_PORT).

qix-serve separates expert-parallel groups by port family, so two groups do not meet. A process that runs tensor parallelism and expert parallelism in one family (TND_MOE_EP_HYBRID=1) has both on MASTER_PORT + 3. Set one of the two overrides there. Whether the two listeners are ever open at the same moment is not measured.

The channel hook

qix has a plugin hook on the four listeners in the table above, and on the connections to them. After each connect and each accept, and before the first byte, the rank calls the loaded channel-security plugin (csrc/distributed/channel_hook.h; call sites at csrc/distributed/rank_id_rendezvous.cpp:146, :197, csrc/distributed/convoy_coordinator.cpp:388, :576, csrc/distributed/tp_batch_channel.cpp:689, :793). The plugin may refuse the connection. The open engine ships no such plugin: with none loaded, the sockets stay plain and the hook costs one branch per connection (plugins.md).

The expert-parallel bootstrap exchange

The expert-parallel exchange swaps memory handles once, at start-up, over the torch-owned gloo group above. qix does not own that socket, so the channel hook is not called on it and no TND-side check can run on it (include/tnd/plugin/channel_security.h:31-33).

Known exposures

Each item is how the code behaves today. None of them is a bug in a trusted network. Each one matters when an untrusted party can reach the socket or send requests.

  1. The tensor-parallel batch frame is plain text. Rank 0 sends every step to the other ranks over the batch channel. Each admitted request in that frame carries its prompt tokens and its prefix-cache key (extra_key_lo, extra_key_hi) in clear (csrc/distributed/tp_batch_channel.cpp:257, csrc/distributed/tp_batch_channel.cpp:261-262). Anyone who can read the traffic between ranks reads the prompts and the cache keys.
  2. qix-serve fetches config.json over the network. When the model's config.json is not in the local Hugging Face cache, qix-serve runs curl against HF_ENDPOINT (default https://huggingface.co) to fetch it (csrc/serve_auto/model_config.cpp:110-119). An HF_TOKEN, when set, goes in the Authorization header. Set HF_HUB_OFFLINE=1 to stop the fetch (csrc/serve_auto/model_config.cpp:106); qix-serve then reads only the local cache.
  3. A client can turn off the end-of-sequence stop. The request body may set ignore_eos and min_tokens (csrc/server/openai_schema.h:24, csrc/server/openai_schema.h:27; parsed at csrc/server/openai_schema.cpp:84-86 and csrc/server/openai_schema.cpp:92). With ignore_eos set, the request keeps generating past the model's end token, up to its max_tokens. With min_tokens set, the end token cannot finish the request until it has produced min_tokens output tokens (csrc/server/serve_loop.cpp:2260-2261, csrc/server/serve_loop.cpp:3284-3285); after that the end token stops it as usual. Either way the request holds a batch row and its KV blocks for longer than the model would choose. A proxy in front of qix can strip these two fields.
  4. A loopback peer can put a rank to sleep. POST /sleep needs no credential, only a loopback peer address and no proxy header (above). Any local process, and any same-host proxy that forwards the route without Forwarded, X-Forwarded-For or X-Real-IP, can stop a rank from serving until POST /wake_up.

What to do

  • Keep the ranks of one group on one host. qix-serve does this.
  • Leave MASTER_ADDR at its default.
  • Firewall the rank ports from everything but the host itself: ports +1 to +4 of every port family in use (29501 to 29504 for the first group at the default base, 29511 to 29514 for the second), any port you set with an override, and the ephemeral ports gloo and NCCL use.
  • Keep the HTTP listener on 127.0.0.1 and put an authenticating proxy in front of it. If the proxy runs on another host, listen on a private address, not 0.0.0.0.
  • Do not forward /tnd/*, /metrics, /sleep, /wake_up or /is_sleeping through a proxy that outside clients reach. A proxy on the same host is a loopback peer. The sleep routes refuse it only when it adds Forwarded, X-Forwarded-For or X-Real-IP, so do not rely on that check. If a same-host proxy must reach the sleep routes on purpose, start the rank with --sleep-remote. Scrape /metrics from inside the private network.
  • Do not pass --sleep-remote on a rank whose port an untrusted host can reach.
  • Set HF_HUB_OFFLINE=1 on hosts that must not reach the internet, after the model is in the local cache.

qix carries no auth mechanism of its own by design: the open engine has hooks, and the proxy or a plugin holds the policy.