Skip to content

Commit ce4151c

Browse files
authored
Add lazy connection page (#317)
* Add lazy connection page * Update based on feedback * Add note about future developments * Fix URL * Add to the navigation
1 parent 3c7b4ab commit ce4151c

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

src/components/NavigationDocs.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const docsNavigation = [
4848
{ title: 'Add Peers', href: '/how-to/add-machines-to-your-network' },
4949
{ title: 'Approve Peers', href: '/how-to/approve-peers' },
5050
{ title: 'Setup Keys', href: '/how-to/register-machines-using-setup-keys' },
51+
{ title: 'Lazy connections concept', href: '/how-to/lazy-connection'},
5152
{
5253
title: 'Access Infrastructure',
5354
isOpen: true,

src/pages/how-to/lazy-connection.mdx

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import {Note} from "@/components/mdx";
2+
3+
# Overview
4+
NetBird now includes an experimental lazy connection feature designed to improve performance and reduce resource usage by connecting to peers only when needed. Instead of maintaining always-on connections, NetBird activates them on-demand based on activity or signaling.
5+
6+
This guide walks you through enabling and configuring this feature in your NetBird client.
7+
8+
<Note>
9+
Minimum supported agent version: <strong>v0.45.0</strong>
10+
</Note>
11+
12+
<Note>
13+
<strong>Self-hosted only:</strong> This feature also requires an upgraded NetBird management server. Make sure your server is updated to the <strong>v0.45.0</strong> version that supports lazy connections.
14+
</Note>
15+
16+
17+
## What Are Lazy Connections?
18+
19+
When enabled, Lazy Connections allow the NetBird agent to:
20+
21+
- Establish peer-to-peer connections **only when required** (e.g., when ping the remote peer).
22+
- Monitor peer activity and **automatically disconnect peers** that remain inactive **and unreachable** for a specified time.
23+
- Keep critical peers (such as routers or excluded peers) **always connected** to ensure uninterrupted communication.
24+
25+
This feature is especially useful in **large-scale deployments** or **resource-constrained environments**, where maintaining full-mesh, permanent connections to all peers is unnecessary and inefficient.
26+
27+
<Note>
28+
When using lazy connections, there may be a **slight delay** when initiating a connection to a peer that is not yet connected. This is expected behavior, as the connection is established on-demand.
29+
</Note>
30+
31+
32+
### How Automatic Disconnection Works
33+
34+
Once a connection between two peers is established, it will remain open **as long as the remote peer is reachable**. The connection is **not** closed just because there is no data transfer.
35+
36+
In other words, the inactivity timer only triggers a disconnect if the peer is both <em>inactive</em> and <em>unreachable</em> for the full duration of the threshold.
37+
38+
<Note>
39+
The default inactivity threshold is <strong>60 minutes</strong>, and can be configured via the <code>NB_LAZY_CONN_INACTIVITY_THRESHOLD</code> environment variable.
40+
</Note>
41+
42+
Additionally, the disconnection logic is being improved and will be enhanced in future releases to better support mobile devices—providing more intelligent reconnection behavior and improved handling of intermittent connectivity.
43+
44+
## Enabling Lazy Connections
45+
46+
Lazy connections are disabled by default. To enable them:
47+
48+
You can enable Lazy Connections using the following environment variable:
49+
50+
```bash
51+
export NB_ENABLE_EXPERIMENTAL_LAZY_CONN=true
52+
```
53+
54+
Or pass the flag directly via the CLI when running the agent:
55+
56+
```bash
57+
netbird up --enable-lazy-connection
58+
```
59+
<Note>
60+
This configuration is <strong>not persistent</strong>. You must reapply the flag or environment variable after each restart unless it is built into your service definition (e.g., systemd or Docker).
61+
</Note>
62+
63+
### Platform-Specific Examples
64+
For platform-specific examples of how to configure this:
65+
66+
- [See Windows example](/how-to/troubleshooting-client#windows)
67+
- [See Linux with systemd example](/how-to/troubleshooting-client#on-linux-with-systemd)
68+
69+
70+
71+
72+
## Get started
73+
<p float="center" >
74+
<Button name="button" className="button-5" onClick={() => window.open("https://netbird.io/pricing")}>Use NetBird</Button>
75+
</p>
76+
77+
- Make sure to [star us on GitHub](https://github.com/netbirdio/netbird)
78+
- Follow us [on Twitter](https://twitter.com/netbird)
79+
- Join our [Slack Channel](https://join.slack.com/t/netbirdio/shared_invite/zt-31rofwmxc-27akKd0Le0vyRpBcwXkP0g)
80+
- NetBird [latest release](https://github.com/netbirdio/netbird/releases) on GitHub

0 commit comments

Comments
 (0)