Basic router example
This is a clean example of a Zenoh router configuration file. While you can further optimize your connection, this setup should enable you to connect your remote computer to the robots successfully.
{
mode: "router",
connect: {
timeout_ms: { router: -1, peer: -1, client: 0 },
endpoints:
{
router: ["tcp/192.168.4.2:7447"], /// Castor connection
peer: [],
client: [],
},
exit_on_failure: { router: false, peer: false, client: true },
retry: {
period_init_ms: 1000,
period_max_ms: 4000,
period_increase_factor: 2,
},
},
listen: {
timeout_ms: -1,
endpoints: [
"tcp/[::]:7447"
],
exit_on_failure: true,
retry: {
period_init_ms: 1000,
period_max_ms: 4000,
period_increase_factor: 2,
},
},
open: {
return_conditions: {
connect_scouted: true,
declares: true,
},
},
scouting: {
timeout: 3000,
delay: 500,
multicast: {
enabled: false,
address: "224.0.0.224:7446",
interface: "auto", // If not set or set to "auto" the interface if picked automatically
ttl: 1,
autoconnect: { router: ["router"], peer: ["router", "peer"] },
listen: true,
},
gossip: {
enabled: true,
multihop: false,
autoconnect: { router: ["router"], peer: ["router", "peer"] },
},
},
timestamping: {
enabled: { router: true, peer: true, client: true },
drop_future_timestamp: false,
},
queries_default_timeout: 100000,
routing: {
router: {
peers_failover_brokering: false,
},
peer: {
mode: "peer_to_peer",
},
},
transport: {
unicast: {
open_timeout: 10000,
accept_timeout: 10000,
accept_pending: 100,
max_sessions: 1000,
max_links: 1,
lowlatency: false,
qos: {
enabled: true,
},
compression: {
enabled: true,
},
},
multicast: {
join_interval: 2500,
max_sessions: 1000,
qos: {
enabled: false,
},
compression: {
enabled: true,
},
},
link: {
tx: {
sequence_number_resolution: "32bit",
lease: 10000,
keep_alive: 4,
batch_size: 65535,
queue: {
size: {
control: 1,
real_time: 1,
interactive_high: 1,
interactive_low: 1,
data_high: 2,
data: 4,
data_low: 4,
background: 4,
},
congestion_control: {
drop: {
wait_before_drop: 100000,
max_wait_before_drop_fragments: 5000000,
},
block: {
wait_before_close: 5000000,
},
},
batching: {
enabled: true,
time_limit: 1,
},
},
},
rx: {
buffer_size: 65535,
max_message_size: 1073741824,
},
tls: {
root_ca_certificate: null,
listen_private_key: null,
listen_certificate: null,
enable_mtls: false,
connect_private_key: null,
connect_certificate: null,
verify_name_on_connect: true,
close_link_on_expiration: false,
},
},
shared_memory: {
enabled: false,
},
auth: {
usrpwd: {
user: null,
password: null,
dictionary_file: null,
},
pubkey: {
public_key_pem: null,
private_key_pem: null,
public_key_file: null,
private_key_file: null,
key_size: null,
known_keys_file: null,
},
},
},
adminspace: {
enabled: true,
permissions: {
read: true,
write: false,
},
},
}
⚙️ Zenoh Router Configuration Reference
Node Mode & Connect/Listen/Open/Scouting/Timing/Routing Configuration
🔹 mode
Key |
Type |
Description |
Example |
mode |
string |
The node's mode: router , peer , client |
"router" |
🛠️ Connect Section
Key |
Type |
Description |
Example |
connect.timeout_ms |
object/indexed |
Timeout per mode (0 = no retry, -1 = infinite) |
{ router: -1, peer: -1, client: 0 } |
connect.endpoints |
array/object |
List of endpoints to connect |
[ "tcp/10.10.10.10:7447" ] |
connect.exit_on_failure |
object |
Whether to exit upon timeout |
{ client: true } |
connect.retry.period_init_ms |
int |
Initial retry delay (ms) |
1000 |
connect.retry.period_max_ms |
int |
Max retry delay (ms) |
4000 |
connect.retry.period_increase_factor |
int |
Backoff multiplier |
2 |
🛎️ Listen Section
Key |
Type |
Description |
Example |
listen.timeout_ms |
int/object |
Timeout waiting for listen endpoints |
0 |
listen.endpoints |
array/object |
List of endpoints to listen on |
[ "tcp/[::]:7447" ] |
listen.exit_on_failure |
bool |
Whether to exit upon failure |
true |
listen.retry.period_init_ms |
int |
Initial retry delay (ms) |
1000 |
listen.retry.period_max_ms |
int |
Max retry delay (ms) |
4000 |
listen.retry.period_increase_factor |
int |
Backoff multiplier |
2 |
🟢 Open Section
Key |
Type |
Description |
Example |
open.return_conditions.connect_scouted |
bool |
Waits for scouted peers/routers before session open returns |
true |
open.return_conditions.declares |
bool |
Waits for initial declares from peers before session open returns |
true |
🔍 Scouting - Multicast
Key |
Type |
Description |
Example |
scouting.timeout |
int |
Timeout (ms) for scouting in client mode |
3000 |
scouting.delay |
int |
Delay (ms) before peer operations |
500 |
scouting.multicast.enabled |
bool |
Enable multicast scouting |
false |
scouting.multicast.address |
string |
Multicast socket address |
"224.0.0.224:7446" |
scouting.multicast.interface |
string |
Interface for multicast (auto = auto-select) |
"auto" |
scouting.multicast.ttl |
int |
Time‑to‑live for multicast packets |
1 |
scouting.multicast.autoconnect |
object |
Which node types to autoconnect on discovery |
{ peer: ["router","peer"] } |
scouting.multicast.autoconnect_strategy |
object |
Strategy to avoid redundant autoconnections |
{ router: { to_router:"always", to_peer:"always" } } |
scouting.multicast.listen |
bool |
Listen/respond to multicast scout messages |
true |
🔍 Scouting - Gossip
Key |
Type |
Description |
Example |
scouting.gossip.enabled |
bool |
Enable gossip scouting |
true |
scouting.gossip.multihop |
bool |
Enable multihop gossip |
false |
scouting.gossip.target |
object |
Gossip targets per mode |
{router:["router","peer"], peer:["router"]} |
scouting.gossip.autoconnect |
object |
Which node types to autoconnect via gossip |
{peer:["router","peer"]} |
scouting.gossip.autoconnect_strategy |
object |
Strategy for gossip-based autoconnections |
{router:{to_router:"always", to_peer:"always"}} |
⏱️ Timestamping
Key |
Type |
Description |
Example |
timestamping.enabled |
object |
Enable timestamping per mode |
{ router:true, peer:true, client:true } |
timestamping.drop_future_timestamp |
bool |
Drop messages with future timestamps, or retimestamp if false |
false |
⏳ Queries
Key |
Type |
Description |
Example |
queries_default_timeout |
int |
Default timeout for queries (ms) |
60000 |
🗺️ Routing
Key |
Type |
Description |
Example |
routing.router.peers_failover_brokering |
bool |
Forward data between peers not directly connected |
false |
routing.router.linkstate.transport_weights |
array |
(Optional) Define transport weights |
[{dst_zid:"1",weight:"10"}] |
routing.peer.mode |
string |
Routing strategy for peers |
"peer_to_peer" |
routing.peer.linkstate.transport_weights |
array |
(Optional) Define transport weights |
[{dst_zid:"2",weight:"200"}] |
routing.interests.timeout |
int |
Timeout waiting for interest declarations (ms) |
10000 |
🛰️ Transport Configuration
🔹 transport.unicast
Parameter |
Type |
Default / Example |
Description |
open_timeout |
Integer |
60000 |
Timeout (ms) when opening a unicast link. |
accept_timeout |
Integer |
60000 |
Timeout (ms) when accepting a unicast link. |
accept_pending |
Integer |
10000 |
Max pending links during handshake. |
max_sessions |
Integer |
10000 |
Max number of simultaneous transports per session. |
max_links |
Integer |
1 |
Max incoming links admitted per transport. |
lowlatency |
Boolean |
false |
Enables low-latency mode (incompatible with qos ). |
qos.enabled |
Boolean |
true |
Enables QoS prioritization. |
compression.enabled |
Boolean |
false |
Enables compression on unicast links. |
🔹 transport.multicast
Parameter |
Type |
Default / Example |
Description |
join_interval |
Integer |
2500 |
JOIN message interval in ms. |
max_sessions |
Integer |
1000 |
Max multicast sessions. |
qos.enabled |
Boolean |
false |
QoS for multicast (disabled by default). |
compression.enabled |
Boolean |
false |
Compression for multicast (disabled by default). |
🔧 Link Parameters (transport.link
)
🔸 transport.link.tx
Parameter |
Type |
Default / Example |
Description |
sequence_number_resolution |
String |
"32bit" |
Sequence number resolution (8bit , 16bit , 32bit , 64bit ). |
lease |
Integer |
60000 |
Lease duration in ms. |
keep_alive |
Integer |
2 |
Number of keep-alive messages per lease. |
batch_size |
Integer |
65535 |
Max batch size in bytes. |
transport.link.tx.queue.size
Priority Queue |
Default |
Description |
Interval |
control |
2 |
Control message queue size. |
1 and 16. Different values will result in an error. |
real_time |
2 |
Real-time message queue size. |
1 and 16. Different values will result in an error. |
interactive_high |
2 |
High-priority interactive queue. |
1 and 16. Different values will result in an error. |
interactive_low |
2 |
Low-priority interactive queue. |
1 and 16. Different values will result in an error. |
data_high |
2 |
High-priority data queue. |
1 and 16. Different values will result in an error. |
data |
2 |
Default data queue. |
1 and 16. Different values will result in an error. |
data_low |
2 |
Low-priority data queue. |
1 and 16. Different values will result in an error. |
background |
2 |
Background queue. |
1 and 16. Different values will result in an error. |
transport.link.tx.queue.congestion_control
Parameter |
Type |
Value |
Description |
drop.wait_before_drop |
Integer |
1000 |
Wait (μs) before dropping a droppable message. |
drop.max_wait_before_drop_fragments |
Integer |
50000 |
Max wait (μs) before dropping multi-fragment messages. |
block.wait_before_close |
Integer |
5000000 |
Max wait (μs) before closing session if blocked. |
transport.link.tx.queue.batching
Parameter |
Type |
Value |
Description |
enabled |
Boolean |
true |
Enables adaptive batching. |
time_limit |
Integer |
1 |
Max retention time (ms) for batching. |
transport.link.tx.queue.allocation
Parameter |
Type |
Value |
Description |
mode |
String |
"lazy" |
Allocation strategy: lazy or init . |
🔸 transport.link.rx
Parameter |
Type |
Default / Example |
Description |
buffer_size |
Integer |
65535 |
RX buffer size in bytes. |
max_message_size |
Integer |
1073741824 |
Max defragmented message size in bytes (default: 1GiB). |
🔐 TLS Configuration (transport.link.tls
)
Parameter |
Type |
Default / Example |
Description |
root_ca_certificate |
Path |
null |
Root CA cert path. |
listen_private_key |
Path |
null |
Private key path for listeners. |
listen_certificate |
Path |
null |
Certificate path for listeners. |
connect_private_key |
Path |
null |
Private key path for clients. |
connect_certificate |
Path |
null |
Certificate path for clients. |
enable_mtls |
Boolean |
false |
Enable mutual TLS authentication. |
verify_name_on_connect |
Boolean |
true |
Verifies hostname/DNS in cert. |
close_link_on_expiration |
Boolean |
false |
Auto-close expired TLS links. |
🧠 Shared Memory (transport.shared_memory
)
Parameter |
Type |
Default / Example |
Description |
enabled |
Boolean |
false |
Enables SHM optimization (requires shared-memory feature). |
mode |
String |
"lazy" |
Init mode: lazy (on first use) or init (on session open). |
🔐 Authentication (transport.auth
)
🔸 usrpwd
(User + Password)
Parameter |
Type |
Default |
Description |
user |
String |
null |
Username. |
password |
String |
null |
Password. |
dictionary_file |
Path |
null |
Path to password dictionary file. |
🔸 pubkey
(Public Key)
Parameter |
Type |
Default |
Description |
public_key_pem |
String |
null |
Inline public key. |
private_key_pem |
String |
null |
Inline private key. |
public_key_file |
Path |
null |
Public key file path. |
private_key_file |
Path |
null |
Private key file path. |
key_size |
Int |
null |
Key size. |
known_keys_file |
Path |
null |
File of trusted keys. |
🛠️ Admin Space Configuration (adminspace
)
Parameter |
Type |
Default / Example |
Description |
enabled |
Boolean |
true |
Enables the admin space (⚠️ unstable feature). |
permissions.read |
Boolean |
true |
Allows reading admin space. |
permissions.write |
Boolean |
false |
Allows writing to admin space. |