# NetBird

> Connect a customer's NetBird account with a read-only token: its peers in Discovery, its routing peers monitored.

URL: https://docs.racktrace.io/integrations/netbird

Link a customer's NetBird account to RackTrace to see every peer in [Discovery](https://docs.racktrace.io/integrations/discovery) and to monitor the peers that route into the customer's network. An administrator connects NetBird once per account; after that everyone works on the Discovery page of their tenant.

This is about your customer's own NetBird. It has nothing to do with how you reach RackTrace itself.

## What you need

RackTrace reads NetBird with a **personal access token** of a **service user** with only read rights:

1. In the NetBird dashboard, go to **Team → Service Users** and click **Create service user**. Give it a name such as *RackTrace* and the role **Auditor** — that role can see everything and change nothing.
2. Open the service user and click **Create token**. Pick an expiry date that suits you and copy the token (it starts with `nbp_`). NetBird shows it only once.

Use the Auditor role, not Admin: RackTrace only reads, and a token that can only read does no harm if it ever leaks. When the token expires, the source shows an error; create a new token and paste it in.

## Connecting NetBird

1. In RackTrace, open **Administration → Integrations** and the **NetBird** tab.
2. **API address**: leave `https://api.netbird.io` for the NetBird cloud. A customer with its own NetBird server fills in the address of that server (`https://netbird.customer.com`; with or without `/api`).
3. Paste the token under **Access token** and click **Connect**.
4. Click **Test connection**: it says how many peers the token can see. Then click **Sync now**. The account appears as one line below.
5. Choose the **Tenant** (customer), the **Location** and, if needed, the **Network** for the account. Only a linked account is read in detail.

The token is stored encrypted on the RackTrace server. It is never shown again — not even its last characters — and it never appears in a log, an export or a mail.

### A NetBird server on a private address

RackTrace reads NetBird over the internet. On racktrace.io — and on any RackTrace server with several organizations — the API address must be public: a NetBird server on a private address (such as `10.0.0.5`, `192.168.1.20` or a `.local` / `.lan` name) is not reachable from RackTrace and is refused, as is a link-local address such as a cloud metadata address.

- Usually this is no problem: the management server of a self-hosted NetBird is already public, because the peers outside the office connect to it. Give RackTrace that same public address.
- Is the server only reachable inside the customer's network? Then RackTrace cannot read it (yet): the RackTrace agent inside the network does not read NetBird. Make the management API reachable on a public HTTPS address, or keep the customer on the NetBird cloud.
- A RackTrace installation of your own, with one organization, may use a private address.

**Refresh every (minutes)** (15 by default; 0 = only on **Sync now**) sets how often RackTrace reads the peers. A customer with more than one NetBird account: click **Add another NetBird account**.

## What RackTrace reads

RackTrace only sends GET requests. It reads:

| What | From NetBird |
|---|---|
| Every peer | Name, NetBird IP, connected or not, last seen, operating system, NetBird version, groups |
| Routing peers | Which peers route into a network: named in a route or as a router of a network, directly or through one of their groups |
| The network side | The networks the routing peers make reachable (routes and network resources), as routes in the [network plan](https://docs.racktrace.io/network/network-plan) review |

It does **not** keep the public address a peer connects from — for a laptop, that is where its user is — and it does not read setup keys, access policies, DNS settings, users or tokens, and it never changes anything in NetBird. At most 5,000 peers are read per sync; NetBird sends its lists in one answer, so each answer is limited in size and time (25 seconds).

## Peers in Discovery

Every peer appears on the Discovery page of the tenant:

- A **routing peer** is network equipment: category **Router**.
- A peer with the NetBird desktop app, or with macOS, Windows 10 / 11, iOS or Android, is an **end device** (a laptop, desktop or phone). End devices are listed with the clients, not with the devices: they give no **New device** notice and no entries in **Changes** (unless linked to a documented device) — someone's laptop going online and offline is not a change in the network.
- Any other peer — a Linux or Windows server without routes — is a **server**, listed with the devices.

The category is a best guess from what NetBird reports; you can change it when you import the device.

NetBird has no **Keep the documentation in sync**: the IP of a peer is its NetBird address, not the management IP of the device in your documentation, so a linked device never takes it over.

## Monitoring

As with the other sources, [monitoring](https://docs.racktrace.io/network/monitoring) watches network equipment by default: the **routing peers**. Laptops, phones and servers are shown in Discovery but are not monitored.

- **Connected** and **last seen** are the state NetBird reports. A peer that is connected is online.
- NetBird drops a peer's connection the moment its line breaks — a laptop that goes to sleep, a router that changes its internet line. So a peer counts as **offline** only when it has not been seen for **5 minutes**. Until then its state is unknown, and a short reconnect is never an incident.
- Between two syncs, RackTrace asks NetBird for the state of the peers every 2 minutes (one call), so a routing peer that goes offline is noticed within minutes.
- Where the RackTrace scanner sees the same device, the scanner measures it; NetBird measures where there is no scanner.

For [source and freshness](https://docs.racktrace.io/concepts/source-and-freshness), NetBird is a **controller API**: the NetBird management server holds the live connection of every peer.

## When something is wrong

The error is shown on the source, under **Last sync**:

| Message | What to do |
|---|---|
| *NetBird refused the token: it is wrong, expired or revoked* | Create a new token for the service user and paste it in. |
| *NetBird refused access … use a service user with the Auditor role* | The token's user may not read the peers: give the service user the Auditor role. |
| *… has no NetBird API at this address* | Check the **API address**: the cloud is `https://api.netbird.io`; for an own server, the address of the management server. |
| *Cannot reach NetBird …* or *did not answer in time* | The server is down or not reachable from RackTrace. |
