IP Ranges and IPAM
Table of Contents
- Address Ranges
- Reserved Addresses
- Client Tunnel IPs
- Server Tunnel IPs
- Private and Shared Blocks
- Backbone Allocation
- Multi-Server Coordination
- Staleness and Reclamation
Address Ranges
| Range | CIDR | Size | Purpose |
|---|---|---|---|
| Client tunnel | 10.64.0.0/10 |
4,194,304 | Encrypted mesh between clients and servers |
| Server backbone | 172.16.0.0/22 |
1,024 | Server-to-server mesh |
| Private subnets | 10.128.0.0/9 |
8,388,608 | Per-customer private addressing |
| Shared blocks | 172.20.0.0/14 |
262,144 | Shared address space |
These ranges are address capacity, not population targets. The Tier 1 target-population table in Security — Compiled Rules is a separate selection goal.
Reserved Addresses
The first ten addresses (.0 through .9) of each allocating subnet are
reserved for system use:
| Address | Purpose |
|---|---|
.0 |
Network address |
.1–.9 |
Reserved for system services |
.10+ |
Allocated addresses |
Client Tunnel IPs (10.64.0.0/10)
The client plane holds three kinds of address:
| Range | Holder | Assigned by |
|---|---|---|
10.65.0.0–10.127.255.254 |
Endpoints | The committed join operation, from the tree (see Configuration) |
10.64.252.0/22 |
Servers | Each server, from its backbone address (see Server Tunnel IPs) |
10.64.0.10 and up |
Endpoints from before tree operations | The sequential IPAM allocator of one server |
- Each address is a
/32; tunnel allocations cannot be expanded. POST /api/ipam/allocatedoes not give tunnel addresses. A client joins to receive one.
Server Tunnel IPs
A server answers its private API (TCP 9101) on its tunnel address. The join
response gives this address to the client as server_tunnel_ip, and the
private.<id>.<region>.seip.<domain> record points to it.
The address is 10.64.252.0 plus the offset of the server’s backbone address
in 172.16.0.0/22. For example, backbone 172.16.1.7 gives tunnel
10.64.253.7. Each server holds its own backbone address (see
Backbone Allocation), so each server holds its own
tunnel address, and the address is the same after a restart. If two servers
claim the same backbone address, the conflict rule moves the losing server
at its next start, and its tunnel address moves with it. A server computes
its own address and records it in its IPAM file. Servers do not ask peers for
an address.
Before this rule, each server took the first sequential address from an IPAM
file that only it (or the peer that answered it) held, so every server bound
10.64.0.10. An updated server moves to its derived address at its first
start; a server that still runs an older release keeps its old address until
it updates.
Private and Shared Blocks
- Private subnets (
10.128.0.0/9): per customer, default/30, expandable. - Shared blocks (
172.20.0.0/14): default/30, expandable.
Backbone Allocation (172.16.0.0/22)
Server backbone IPs are allocated deterministically from the server identity:
- Hash the server’s base64 Ed25519 gossip public key with a
multiply-by-31 rolling hash over the first 16 bytes
(
hash = hash * 31 + byte). preferred_offset = (hash % 1014) + 10— offsets10through1023(the first ten addresses are reserved).- If the preferred offset is taken, probe forward linearly, wrapping from
1023back to10.
The result is the same preferred address for the same identity on every server, so an offline holder’s slot is reproducible.
Conflict Resolution
When two servers claim the same backbone IP, the higher pubkey wins (lexicographic comparison of the base64 keys); the loser re-probes to the next free slot. A backbone claim is only applied when it is signed by the named server itself (origin-verified) and that server holds a root-signed certificate — third parties evict nobody. Deterministic, no clock dependency, no central authority.
Multi-Server Coordination
Backbone allocations sync via gossip:
- Message type:
BackboneIpamSync(0x13). - Ingress is certificate-gated (root-signed, non-revoked peer).
- Deltas are deduplicated by
delta_id; new allocations are forwarded to all peers. - Each server announces its own claim directly to every certified peer after each accepted ServerHello and every 300 seconds, so late joiners and restarted servers learn it without a full table transfer.
- A direct claim also carries the server’s mesh public key. The key is outside the signed claim, so a receiver accepts it only when the packet signer is the claim’s subject. With both the address and the key, the receiver adds the BoringTun backbone peer.
Gossip catch-up sync (SyncDigest 0x17, SyncRequest 0x18) runs over the
backbone on virtual UDP at the backbone address and the gossip port. It is
not a new public port. Tier 1 servers serve catch-up to every certified
server; Tier 2 servers catch up from Tier 1 and report their sync status to
Tier 1, but never supply records to it. Two streams use it: DNS records and
account group-key envelopes.
Permission tree sync (Digest, DeltaRequest, DeltaResponse) also runs
only on the backbone, between Tier 1 members with a ready backbone path. A
Tier 2 server holds no tree and runs no tree sync. A server that has no
backbone path to a peer exchanges no tree records with it.
Account group-key envelopes (AccountEnvelopeSync 0x19) travel only on the
backbone. A Tier 1 server that accepts an envelope from a device signs it
with its gossip key and sends it to every certified peer; peers that miss it
catch up from the next digest. A receiver accepts an envelope only from a
current Tier 1 sender, verifies the origin server’s signature and
certificate, and re-checks against its own permission tree that the
uploading device may write the account group and that the recipient is a
device in that group. A Tier 2 server holds no tree, so it can check no
envelope and accepts none.
Chat blobs are not replicated; they stay on the server that stored them.
Client tunnel, private, and shared allocations are currently managed per server; full cross-server IPAM sync for those pools is not implemented. Two servers could assign the same client IP if they allocate simultaneously — a known limitation, not a conflict-resolved guarantee.
Staleness and Reclamation
- Tunnel and backbone allocations record
last_seen, refreshed by heartbeats and gossip ticks. - The code contains a tunnel-lease sweep and a stale-backbone collector, but neither is wired to a periodic pass in the current revision. A departed node’s backbone IP is therefore not automatically reclaimed today, and lease expiry does not run on a timer.
This is an implementation gap, documented here so operators do not rely on automatic reclamation.