### Start NetBird Daemon with Setup Key Source: https://docs.netbird.io/get-started/cli Start the NetBird daemon and authenticate using a setup key. Ensure the setup key is valid. ```bash netbird up --setup-key AAAA-BBB-CCC-DDDDDD ``` -------------------------------- ### Start NetBird with a Setup Key Source: https://docs.netbird.io/get-started/install/synology Use this command to start NetBird with a provided setup key. This is useful for automated deployments. ```bash netbird up --setup-key ``` -------------------------------- ### Install and Start NetBird Service (Binary) Source: https://docs.netbird.io/get-started/install/linux Installs and starts the NetBird client daemon service after manual binary installation. ```bash sudo netbird service install sudo netbird service start ``` -------------------------------- ### Start NetBird with Setup Key Source: https://docs.netbird.io/get-started/install/macos Activate a server peer using a setup key. This is useful for infrastructure-as-code deployments. ```bash netbird up --setup-key ``` -------------------------------- ### Start NetBird with Setup Key Source: https://docs.netbird.io/get-started Connects the installed NetBird agent to your NetBird account using a generated setup key. This command should be run on the gateway machine after the agent installation. ```bash netbird up --setup-key ``` -------------------------------- ### Install and Start NetBird Service (Homebrew) Source: https://docs.netbird.io/get-started/install/linux Installs and starts the NetBird client daemon service using the Homebrew installation path. Adjust the path if your Homebrew prefix is non-default. ```bash sudo /home/linuxbrew/.linuxbrew/bin/netbird service install sudo /home/linuxbrew/.linuxbrew/bin/netbird service start ``` -------------------------------- ### Create Postinstall Script for NetBird CLI Source: https://docs.netbird.io/manage/integrations/mdm-deployment/macos-cli-pkg-deployment The postinstall script installs and starts the NetBird launchd daemon service. It also handles the initial enrollment of the peer using a setup key if it's a first-time installation. ```bash #!/bin/sh LOG_FILE=/var/log/netbird/client_post_install.log AGENT=/usr/local/bin/netbird mkdir -p /var/log/netbird/ { echo "=== NetBird CLI postinstall: $(date) ===" # Install and start the daemon service $AGENT service install 2>/dev/null || true $AGENT service start || { echo "ERROR: Failed to start NetBird service" exit 1 } # Enroll the peer if not already configured. # The config file exists once the peer has been enrolled at least once. CONFIG_FILE="/var/lib/netbird/config.json" if [ ! -f "$CONFIG_FILE" ]; then echo "First install detected — enrolling with setup key" # Replace YOUR_SETUP_KEY with your actual reusable setup key. # For self-hosted deployments, add: --management-url https://your-management.example.com $AGENT up --setup-key YOUR_SETUP_KEY else echo "Existing configuration found — skipping enrollment" fi echo "Postinstall complete" exit 0 } >> "$LOG_FILE" 2>&1 POSTINSTALL ``` -------------------------------- ### Start NetBird with Setup Key and Custom Management URL Source: https://docs.netbird.io/get-started/install/macos Connect to a self-hosted Management Service using a setup key and specifying the management URL. ```bash netbird up --setup-key --management-url http://localhost:33073 ``` -------------------------------- ### Setup Instance Response Source: https://docs.netbird.io/api/resources/instance Example response for the Setup Instance endpoint, including the new user's ID, email, and a provisioned Personal Access Token if requested. ```json { "user_id": "abc123def456", "email": "admin@example.com", "personal_access_token": "nbp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } ``` -------------------------------- ### Get Instance Status Response Source: https://docs.netbird.io/api/resources/instance Example response for the Get Instance Status endpoint, showing whether setup is required. ```json { "setup_required": true } ``` -------------------------------- ### Install and Start NetBird Daemon Service (CLI-only) Source: https://docs.netbird.io/get-started/install/macos Installs and starts the NetBird client daemon service after a CLI-only Homebrew installation. ```bash sudo netbird service install ``` ```bash sudo netbird service start ``` -------------------------------- ### Automated Deployment with MSI Installer and Setup Key Source: https://docs.netbird.io/get-started/install/windows Combine a silent MSI installation with the 'netbird up --setup-key' command for fully automated peer registration without user interaction. ```bash msiexec /i netbird_installer__windows_amd64.msi /quiet netbird up --setup-key ``` -------------------------------- ### Retrieve a Setup Key Source: https://docs.netbird.io/api/resources/setup-keys Get information about a specific setup key using its unique identifier. ```APIDOC ## GET /api/setup-keys/{keyId} ### Description Retrieve information about a setup key. ### Method GET ### Endpoint /api/setup-keys/{keyId} ### Parameters #### Path Parameters - **keyId** (string) - Required - The unique identifier of a setup key ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the setup key - **name** (string) - The name of the setup key - **expires** (string) - The expiration date and time of the setup key - **type** (string) - The type of the setup key (e.g., "reusable") - **valid** (boolean) - Indicates if the setup key is currently valid - **revoked** (boolean) - Indicates if the setup key has been revoked - **used_times** (integer) - The number of times the setup key has been used - **last_used** (string) - The date and time the setup key was last used - **state** (string) - The current state of the setup key (e.g., "valid") - **auto_groups** (array of strings) - List of group IDs to auto-assign to peers registered with this key - **updated_at** (string) - The date and time the setup key was last updated - **usage_limit** (integer) - The maximum number of times the setup key can be used (0 for unlimited) - **ephemeral** (boolean) - Indicates if the setup key is ephemeral - **allow_extra_dns_labels** (boolean) - Indicates if extra DNS labels are allowed - **key** (string) - The setup key itself (partially masked in response) ### Response Example ```json { "id": 2531583362, "name": "Default key", "expires": "2023-06-01T14:47:22.291057Z", "type": "reusable", "valid": true, "revoked": false, "used_times": 2, "last_used": "2023-05-05T09:00:35.477782Z", "state": "valid", "auto_groups": [ "ch8i4ug6lnn4g9hqv7m0" ], "updated_at": "2023-05-05T09:00:35.477782Z", "usage_limit": 0, "ephemeral": true, "allow_extra_dns_labels": true, "key": "A6160****" } ``` ``` -------------------------------- ### Start NetBird with Custom Management URL Source: https://docs.netbird.io/get-started/install/synology Start NetBird using a specific management URL and a setup key. Useful when hosting your own management service. ```bash netbird up --setup-key --management-url http://localhost:33073 ``` -------------------------------- ### Automated VM Provisioning with User Data Script Source: https://docs.netbird.io/use-cases/cloud/distributed-multi-cloud-ai This script automates the setup of a VM for the distributed AI infrastructure. It installs NetBird, MicroK8s, and essential addons, and configures GPU support. Ensure you replace `` with your actual NetBird setup key. ```bash #!/bin/bash sudo hostnamectl set-hostname telekom-germany-cluster sudo apt update sudo DEBIAN_FRONTEND=noninteractive apt install ca-certificates curl gnupg snapd vim ubuntu-drivers-common -y sudo curl -L https://pkgs.netbird.io/debian/public.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/netbird.gpg sudo echo 'deb https://pkgs.netbird.io/debian stable main' | sudo tee /etc/apt/sources.list.d/netbird.list sudo apt update && apt install netbird -y exec 1>/root/startup.log 2>&1 sudo netbird up --setup-key --management-url https://api.netbird.io --hostname telekom-germany-cluster --allow-server-ssh sudo ufw disable || true sudo snap install microk8s --classic --channel 1.32/stable sudo microk8s status --wait-ready sudo usermod -a -G microk8s ubuntu sudo chown -f -R ubuntu ~/.kube microk8s disable ha-cluster --force sudo microk8s status --wait-ready for addon in dns helm3 hostpath-storage; do microk8s enable $addon done microk8s enable gpu --gpu-operator-version v25.10.0 --gpu-operator-set toolkit.env[3].name=RUNTIME_CONFIG_SOURCE --gpu-operator-set toolkit.env[3].value='file=/var/snap/microk8s/current/args/containerd.toml' microk8s status --wait-ready echo "End of startup.sh" ``` -------------------------------- ### Automated Deployment with EXE Installer and Setup Key Source: https://docs.netbird.io/get-started/install/windows Combine a silent EXE installation with the 'netbird up --setup-key' command for fully automated peer registration without user interaction. ```bash netbird_installer__windows_amd64.exe /S netbird up --setup-key ``` -------------------------------- ### Start NetBird Daemon with Setup Key and Extra DNS Labels Source: https://docs.netbird.io/get-started/cli Start the NetBird daemon with a setup key and configure extra DNS labels for advanced network configurations. The setup key must have the 'Allow Extra DNS Labels' option enabled. ```bash netbird up --setup-key AAAA-BBB-CCC-DDDDDD --extra-dns-labels vpc1,mgmt1 ``` -------------------------------- ### Retrieve a Setup Key Source: https://docs.netbird.io/api/resources/setup-keys Use this endpoint to get information about a specific setup key by its ID. Requires authentication. ```curl curl -X GET https://api.netbird.io/api/setup-keys/{keyId} \ -H 'Accept: application/json' \ -H 'Authorization: Token ' ``` -------------------------------- ### Run NetBird with Setup Key on Linux Source: https://docs.netbird.io/get-started After installation, use this command to connect your headless Linux server to your NetBird network using a unique setup key. Replace with your actual key. ```bash netbird up --setup-key ``` -------------------------------- ### Deploy NetBird on Cloud Workloads (VMs) Source: https://docs.netbird.io/manage/networks/use-cases/cloud-to-on-premise Installs NetBird on cloud virtual machines using a curl script and starts the service with a cloud-specific setup key. ```bash curl -fsSL https://pkgs.netbird.io/install.sh | sh sudo netbird up --setup-key YOUR_CLOUD_SETUP_KEY ``` -------------------------------- ### Setup Keys Source: https://docs.netbird.io/api/introduction Manage setup keys for onboarding new peers, including creation, retrieval, updates, and listing. ```APIDOC ## Setup Keys The Setup Keys resource is used to manage keys that facilitate the onboarding of new peers to your NetBird network. ### Operations - **Create Setup Key**: Generate a new setup key. - **Retrieve Setup Key**: Get details of a specific setup key. - **Update Setup Key**: Modify an existing setup key. - **List Setup Keys**: View all available setup keys. Refer to the 'Resources' section for specific endpoint details and parameters. ``` -------------------------------- ### Setup Instance Source: https://docs.netbird.io/api/resources/instance Creates the initial admin user for the instance. This endpoint is available only when setup is required and does not need authentication. It can optionally create a Personal Access Token (PAT). ```APIDOC ## POST /api/setup ### Description Creates the initial admin user for the instance. This endpoint does not require authentication but only works when setup is required (no accounts exist and embedded IDP is enabled). When the management server is started with `NB_SETUP_PAT_ENABLED=true` and the request includes `create_pat: true`, the endpoint also provisions the NetBird account for the new owner user and returns the plain text Personal Access Token in `personal_access_token`. The optional `pat_expire_in` value applies only when `create_pat` is true and defaults to 1 day when omitted. If a post-user step fails, setup-created resources are rolled back when safe; if account cleanup fails, the owner user is left in place to avoid leaving an account without its admin user. ### Method POST ### Endpoint /api/setup ### Parameters #### Request Body - **email** (string) - Required - Email address for the admin user. - **password** (string) - Required - Password for the admin user (minimum 8 characters). - **name** (string) - Required - Display name for the admin user (defaults to email if not provided). - **create_pat** (boolean) - Optional - If true and the server has setup-time PAT issuance enabled, create a Personal Access Token for the new owner user and return it in the response. Ignored when the server feature is disabled. - **pat_expire_in** (integer) - Optional - Expiration of the Personal Access Token in days. Applies only when `create_pat` is true and the server feature is enabled. Defaults to 1 day when omitted. (Possible Values: >=1 and <=365) ### Request Example ```json { "email": "admin@example.com", "password": "securepassword123", "name": "Admin User", "create_pat": true, "pat_expire_in": 30 } ``` ### Response #### Success Response (200) - **user_id** (string) - The unique identifier for the created user. - **email** (string) - The email address of the created admin user. - **personal_access_token** (string) - The generated Personal Access Token, if `create_pat` was true and enabled. ### Response Example ```json { "user_id": "abc123def456", "email": "admin@example.com", "personal_access_token": "nbp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } ``` ``` -------------------------------- ### Create User with Go Source: https://docs.netbird.io/api/resources/users A Go program demonstrating how to create a user. This example covers setting up the request body and making the POST request. ```go package main import ( "bytes" "encoding/json" "fmt" "log" "net/http" ) func main() { url := "https://api.netbird.io/api/users" requestBody := map[string]interface{}{ "email": "demo@netbird.io", "name": "Tom Schulz", "role": "admin", "auto_groups": []string{ "ch8i4ug6lnn4g9hqv7m0", }, "is_service_user": false, } requestBodyBytes, err := json.Marshal(requestBody) if err != nil { log.Fatalf("Error marshaling request body: %v", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(requestBodyBytes)) if err != nil { log.Fatalf("Error creating request: %v", err) } http.DefaultClient.Do(req) req.Header.Set("Accept", "application/json") req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Token ") client := &http.Client{} resp, err := client.Do(req) if err != nil { log.Fatalf("Error sending request: %v", err) } defer resp.Body.Close() fmt.Println("Status Code:", resp.StatusCode) } ``` -------------------------------- ### Create first owner and PAT Source: https://docs.netbird.io/selfhosted/automated-setup This snippet demonstrates how to call the setup API to create the first owner user and a personal access token. Set `create_pat: true` to request a PAT and optionally specify `pat_expire_in` for its lifetime in days. ```APIDOC ## POST /api/setup ### Description Creates the first owner user and optionally a personal access token (PAT). ### Method POST ### Endpoint /api/setup ### Parameters #### Request Body - **email** (string) - Required - Email address for the first owner user. - **name** (string) - Required - Display name for the first owner user. - **password** (string) - Required - Password for the first owner user. - **create_pat** (boolean) - Optional - Set to `true` to request a setup PAT. Ignored unless `NB_SETUP_PAT_ENABLED=true`. - **pat_expire_in** (integer) - Optional - PAT lifetime in days. Applies only when `create_pat` is true. Defaults to `1`; allowed range is `1` to `365`. ### Request Example ```json { "email": "admin@example.com", "name": "Admin User", "password": "use-a-long-random-password", "create_pat": true, "pat_expire_in": 7 } ``` ### Response #### Success Response (200) - **user_id** (string) - The ID of the created user. - **email** (string) - The email address of the created user. - **personal_access_token** (string) - The generated PAT if `create_pat` was true and `NB_SETUP_PAT_ENABLED` was true. This field may be absent. #### Response Example ```json { "user_id": "abc123def456", "email": "admin@example.com", "personal_access_token": "nbp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } ``` ### Notes - The response includes `Cache-Control: no-store` because it may contain a plain text token. Avoid logging the response body in CI/CD systems. - If `create_pat` is omitted or false, setup creates only the owner user. - If `NB_SETUP_PAT_ENABLED` is not set to `true`, NetBird ignores the PAT request and returns a setup response without `personal_access_token`. ``` -------------------------------- ### Install and Configure NetBird Routing Peer Source: https://docs.netbird.io/manage/networks/homelab/access-home-network Install NetBird on your chosen routing peer device and connect it to your NetBird network using a setup key. Ensure the setup key has the 'home-lan' group assigned. ```bash curl -fsSL https://pkgs.netbird.io/install.sh | sh sudo netbird up --setup-key YOUR_SETUP_KEY ``` -------------------------------- ### NetBird Environment Configuration Example Source: https://docs.netbird.io/selfhosted/selfhosted-guide Example setup.env file for NetBird self-hosting. Copy this to setup.env and update values for domain, OIDC, Let's Encrypt email, and authentication providers. ```bash ## example file, you can copy this file to setup.env and update its values ## # Dashboard domain. e.g. app.mydomain.com NETBIRD_DOMAIN="" # OIDC configuration e.g., https://example.eu.auth0.com/.well-known/openid-configuration NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT="" NETBIRD_AUTH_AUDIENCE="" # e.g. netbird-client NETBIRD_AUTH_CLIENT_ID="" # indicates whether to use Auth0 or not: true or false NETBIRD_USE_AUTH0="false" NETBIRD_AUTH_DEVICE_AUTH_PROVIDER="none" # enables Interactive SSO Login feature (Oauth 2.0 Device Authorization Flow) NETBIRD_AUTH_DEVICE_AUTH_CLIENT_ID="" # e.g. hello@mydomain.com NETBIRD_LETSENCRYPT_EMAIL="" ``` -------------------------------- ### List All Setup Keys (cURL) Source: https://docs.netbird.io/api/resources/setup-keys Use this endpoint to retrieve a list of all existing setup keys. Ensure your Authorization header includes a valid token. ```curl curl -X GET https://api.netbird.io/api/setup-keys \ -H 'Accept: application/json' \ -H 'Authorization: Token ' ``` -------------------------------- ### Get Version Info Response Source: https://docs.netbird.io/api/resources/instance Example response for the Get Version Info endpoint, detailing current and available versions. ```json { "management_current_version": "0.35.0", "dashboard_available_version": "2.10.0", "management_available_version": "0.35.0", "management_update_available": true } ``` -------------------------------- ### Get All Google IDP Integrations Response Example Source: https://docs.netbird.io/api/resources/idp-google-integrations Example response structure for retrieving all Google Workspace IDP integrations. ```json [ { "enabled": true, "group_prefixes": [ "Engineering", "Sales" ], "user_group_prefixes": [ "Users" ], "connector_id": { "type": "string", "description": "DEX connector ID for embedded IDP setups" }, "id": 1, "customer_id": "C01234567", "sync_interval": 300, "last_synced_at": "2023-05-15T10:30:00Z" } ] ``` -------------------------------- ### Create a Setup Key Source: https://docs.netbird.io/api/resources/setup-keys Creates a new setup key with specified properties. You can define its name, type, expiration, associated groups, usage limits, and ephemeral status. ```APIDOC ## POST /api/setup-keys ### Description Creates a setup key. ### Method POST ### Endpoint /api/setup-keys ### Parameters #### Request Body - **name** (string) - Required - Setup Key name. - **type** (string) - Required - Setup key type, one-off for single time usage and reusable. - **expires_in** (integer) - Required - Expiration time in seconds. Possible Values: `>=86400` and `<=31536000`. - **auto_groups** (array of strings) - Required - List of group IDs to auto-assign to peers registered with this key. - **usage_limit** (integer) - Required - A number of times this key can be used. The value of 0 indicates unlimited usage. - **ephemeral** (boolean) - Optional - Indicate that the peer will be ephemeral or not. - **allow_extra_dns_labels** (boolean) - Optional - Allow extra DNS labels to be added to the peer. ### Request Example { "example": "{\"name\": \"Default key\", \"type\": \"reusable\", \"expires_in\": 86400, \"auto_groups\": [\"ch8i4ug6lnn4g9hqv7m0\"], \"usage_limit\": 0, \"ephemeral\": true, \"allow_extra_dns_labels\": true}" } ### Response #### Success Response (200) - **id** (integer) - Unique identifier for the setup key. - **name** (string) - The name of the setup key. - **expires** (string) - The expiration date and time of the setup key. - **type** (string) - The type of the setup key (e.g., "reusable", "one-off"). - **valid** (boolean) - Indicates if the setup key is currently valid. - **revoked** (boolean) - Indicates if the setup key has been revoked. - **used_times** (integer) - The number of times the setup key has been used. - **last_used** (string) - The timestamp of the last usage. - **state** (string) - The current state of the setup key (e.g., "valid"). - **auto_groups** (array of strings) - List of group IDs automatically assigned to peers. - **updated_at** (string) - The timestamp when the setup key was last updated. - **usage_limit** (integer) - The maximum number of times the key can be used (0 for unlimited). - **ephemeral** (boolean) - Indicates if peers registered with this key are ephemeral. - **allow_extra_dns_labels** (boolean) - Indicates if extra DNS labels are allowed. - **key** (string) - The setup key itself. ### Response Example { "example": "{ \"id\": 2531583362, \"name\": \"Default key\", \"expires\": \"2023-06-01T14:47:22.291057Z\", \"type\": \"reusable\", \"valid\": true, \"revoked\": false, \"used_times\": 2, \"last_used\": \"2023-05-05T09:00:35.477782Z\", \"state\": \"valid\", \"auto_groups\": [ \"ch8i4ug6lnn4g9hqv7m0\" ], \"updated_at\": \"2023-05-05T09:00:35.477782Z\", \"usage_limit\": 0, \"ephemeral\": true, \"allow_extra_dns_labels\": true, \"key\": \"A616097E-FCF0-48FA-9354-CA4A61142761\" }" } ``` -------------------------------- ### Back Up Configuration Files (Current Setup) Source: https://docs.netbird.io/selfhosted/maintenance/backup Copy essential configuration files to a backup directory for the current NetBird installation setup. ```bash mkdir backup cp docker-compose.yml dashboard.env config.yaml backup/ ``` -------------------------------- ### Start NetBird Service Source: https://docs.netbird.io/get-started/cli Starts the NetBird daemon service. If installed with specific flags like --disable-profiles, these settings will be maintained. ```bash sudo netbird service start ``` -------------------------------- ### Create Welcome HTML File Source: https://docs.netbird.io/manage/peers/access-infrastructure/setup-keys-add-servers-to-network Generate an index.html file with a welcome message to be served by the Nginx container. ```bash echo "

Welcome to NetBird Demo

If you can see this, you've successfully connected to the container via NetBird.

" > index.html ``` -------------------------------- ### Install NetBird using EXE Installer Script Source: https://docs.netbird.io/manage/for-partners/acronis-integration This PowerShell script automates the download and silent installation of the latest NetBird EXE installer from GitHub releases. It supports passing setup keys and management URLs for initial configuration. ```PowerShell # NetBird Windows Installation Script # Requires Administrator privileges param( [string]$SetupKey = "", [string]$ManagementUrl = "", [switch]$Silent = $true ) # Check if running as Administrator if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Write-Error "This script requires Administrator privileges. Please run as Administrator." exit 1 } try { # Define variables $TempDir = $env:TEMP $NetBirdInstaller = "$TempDir\netbird-installer.exe" # Get the latest release URL from GitHub API Write-Host "Fetching latest NetBird release information..." $ReleaseInfo = Invoke-RestMethod -Uri "https://api.github.com/repos/netbirdio/netbird/releases/latest" # Find Windows installer (look for .exe file) $WindowsAsset = $ReleaseInfo.assets | Where-Object { $_.name -like "*windows*" -and $_.name -like "*.exe" } if (-not $WindowsAsset) { Write-Error "Could not find Windows installer in latest release" exit 1 } $DownloadUrl = $WindowsAsset.browser_download_url Write-Host "Found installer: $($WindowsAsset.name)" # Download the installer Write-Host "Downloading NetBird installer..." Invoke-WebRequest -Uri $DownloadUrl -OutFile $NetBirdInstaller # Install NetBird Write-Host "Installing NetBird..." if ($Silent) { $InstallArgs = "/S" # Silent installation flag for NSIS-based installers Start-Process -FilePath $NetBirdInstaller -ArgumentList $InstallArgs -Wait -NoNewWindow } else { Start-Process -FilePath $NetBirdInstaller -Wait } # Verify installation $NetBirdPath = "C:\Program Files\NetBird\netbird.exe" if (Test-Path $NetBirdPath) { Write-Host "NetBird installed successfully at: $NetBirdPath" -ForegroundColor Green # Start NetBird service if it exists $Service = Get-Service -Name "NetBird*" -ErrorAction SilentlyContinue if ($Service) { Write-Host "Starting NetBird service..." Start-Service $Service.Name } # Connect with setup key if provided if ($SetupKey) { Write-Host "Connecting NetBird with setup key..." $ConnectArgs = @("up", "--setup-key", $SetupKey) if ($ManagementUrl) { $ConnectArgs += @("--management-url", $ManagementUrl) } & $NetBirdPath $ConnectArgs } } else { Write-Error "Installation verification failed. NetBird not found at expected location." exit 1 } } catch { Write-Error "Installation failed: $($_.Exception.Message)" exit 1 } finally { # Cleanup if (Test-Path $NetBirdInstaller) { Remove-Item $NetBirdInstaller -Force } } Write-Host "NetBird installation completed successfully!" -ForegroundColor Green ``` -------------------------------- ### Run NetBird with Docker and Setup Key Source: https://docs.netbird.io/get-started/install Deploy NetBird using Docker with a setup key. Ensure you replace `` and `` with your specific values. Requires privileged mode and a volume for persistent data. ```bash docker run --network host --privileged --rm -d -e NB_SETUP_KEY= -v netbird-client:/var/lib/netbird netbirdio/netbird: ``` -------------------------------- ### Stop old containers for external proxy setups Source: https://docs.netbird.io/selfhosted/migration/combined-container Stop the existing NetBird containers before starting the new ones during migration for external proxy setups. ```bash cd /opt/netbird # or your install directory docker compose down ``` -------------------------------- ### Initialize Terraform Modules and Providers Source: https://docs.netbird.io/use-cases/cloud/aws-ecs-terraform Run this command in the 'ecs-client-daemon' directory to download necessary Terraform modules and providers for the example. ```bash cd ecs-client-daemon terraform init ``` -------------------------------- ### Example NetBird Integration Created Event Source: https://docs.netbird.io/manage/activity/event-streaming/amazon-s3 This is an example of an 'integration created' event sent by NetBird upon successful setup of an S3 event streaming integration. ```json { "timestamp": "2024-04-11T19:01:08.769292+02:00", "message": "integration created", "id": 0, "initiator_id": "netbird", "target_id": "netbird", "meta": null, "reference": "" } ``` -------------------------------- ### Create a Setup Key (cURL) Source: https://docs.netbird.io/api/resources/setup-keys Use this endpoint to create a new setup key. You can specify parameters like name, type, expiration, auto-groups, usage limit, and ephemeral settings. The `usage_limit` of 0 means unlimited usage. ```curl curl -X POST https://api.netbird.io/api/setup-keys \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ \ "name": "Default key", \ "type": "reusable", \ "expires_in": 86400, \ "auto_groups": [ \ "ch8i4ug6lnn4g9hqv7m0" \ ], \ "usage_limit": 0, \ "ephemeral": true, \ "allow_extra_dns_labels": true \ }' ``` -------------------------------- ### Install NetBird on Raspberry Pi Source: https://docs.netbird.io/get-started/install/raspberrypi Install NetBird using the provided one-line script. This command downloads the script, detects your system, adds the NetBird repository, installs the latest version, and configures the service to start on boot. ```bash curl -fsSL https://pkgs.netbird.io/install.sh | sh ``` -------------------------------- ### Starting and Verifying Proxy Instance Source: https://docs.netbird.io/selfhosted/maintenance/scaling/multiple-proxy-instances Use Docker Compose commands to pull the latest images, start the proxy instance in detached mode, and then follow the logs to confirm it has connected and registered. ```bash docker compose pull docker compose up -d # Verify the proxy is running docker compose logs -f proxy ``` -------------------------------- ### Install NetBird on Routing Peers Source: https://docs.netbird.io/manage/network-routes/use-cases/site-to-site Use this command to install NetBird on your routing peers. Ensure you replace YOUR_SETUP_KEY with the actual setup key generated in the NetBird UI. ```bash curl -fsSL https://pkgs.netbird.io/install.sh | sh sudo netbird up --setup-key YOUR_SETUP_KEY ``` -------------------------------- ### Create a setup key inside a tenant Source: https://docs.netbird.io/api/guides/msp-api-access Use this POST request with the `account` parameter to create a setup key within a specific tenant. Ensure the `Content-Type` is set to `application/json` and provide the key details in the request body. ```curl curl -X POST https://api.netbird.io/api/setup-keys?account= \ -H "Authorization: Token {token}" \ -H "Content-Type: application/json" \ -d '{"name":"bootstrap","type":"reusable"}' ``` -------------------------------- ### Enable SQLite in Older Multi-Container Setup Source: https://docs.netbird.io/selfhosted/maintenance/sqlite-store Configure the `setup.env` file to use SQLite as the storage engine for older multi-container deployments. ```bash NETBIRD_STORE_CONFIG_ENGINE=sqlite ``` -------------------------------- ### NetBird Post-install Script for Kandji Source: https://docs.netbird.io/manage/integrations/mdm-deployment/kandji-netbird-integration This script completes the NetBird installation by verifying the app, creating symlinks, installing and starting the NetBird service, and initiating the connection with a custom hostname. It also handles the SSO login flow for first-time installations. ```shell #!/bin/sh set -x APP=/Applications/NetBird.app AGENT=/usr/local/bin/netbird LOG_FILE=/var/log/netbird/client_post_install.log mkdir -p /var/log/netbird/ mkdir -p /usr/local/bin/ { echo "Installing NetBird..." if test -d $APP; then echo "NetBird app copied successfully." else echo "NetBird app could not be copied to the Applications folder." exit 1 fi ln -fs $APP/Contents/MacOS/netbird $AGENT if test -f $AGENT; then echo "NetBird binary linked successfully." else echo "NetBird could not create symlink to /usr/local/bin" exit 1 fi $AGENT service install || true $AGENT service start || true $AGENT up --hostname YOUR_CUSTOM_HOSTNAME_HERE open $APP echo "Finished Netbird installation successfully" exit 0 # all good } &> $LOG_FILE ``` -------------------------------- ### Download and Run NetBird Installation Script Source: https://docs.netbird.io/selfhosted/selfhosted-quickstart Use this command to download and execute the NetBird installation script. It sets up a production-ready NetBird instance. ```bash curl -fsSL https://github.com/netbirdio/netbird/releases/latest/download/getting-started.sh | bash ``` -------------------------------- ### Install NetBird and Enroll Routing Peer Source: https://docs.netbird.io/manage/networks/use-cases/site-to-vpn Installs NetBird on a routing peer and enrolls it using a provided setup key. Ensure the peer appears in the dashboard with the correct group assignment. ```bash curl -fsSL https://pkgs.netbird.io/install.sh | sh sudo netbird up --setup-key YOUR_SITE_SETUP_KEY ``` -------------------------------- ### Install NetBird Service with Disabled Profiles and Update Settings Source: https://docs.netbird.io/get-started/cli Installs the NetBird service with profiles and update settings disabled, suitable for managed environments. It also includes a setup key. ```bash sudo netbird service install \ --setup-key AAAA-BBB-CCC-DDDDDD \ --disable-profiles \ --disable-update-settings ``` -------------------------------- ### Complete Instance Setup via API with cURL Source: https://docs.netbird.io/selfhosted/identity-providers/local Automate the initial NetBird instance setup by sending a POST request to the `/api/setup` endpoint with user credentials. This creates the first owner account. ```bash # Complete setup curl -X POST "https://netbird.example.com/api/setup" \ -H "Content-Type: application/json" \ -d '{ "email": "admin@example.com", "password": "securepassword123", "name": "Admin User" }' ``` ```json # Response: { "user_id": "user-abc123", "account_id": "account-xyz789" } ``` -------------------------------- ### Back Up Configuration Files (Older Setup) Source: https://docs.netbird.io/selfhosted/maintenance/backup Copy configuration files for deployments using separate containers for management, signal, relay, and coturn. ```bash mkdir backup cp docker-compose.yml Caddyfile dashboard.env management.json relay.env backup/ ``` -------------------------------- ### Get NetBird Version Source: https://docs.netbird.io/help/report-bug-issues Use this command to retrieve the currently installed NetBird version. This is often required when reporting issues. ```bash netbird version ``` -------------------------------- ### Enable PostgreSQL in setup.env (Older Setup) Source: https://docs.netbird.io/selfhosted/maintenance/postgres-store For older multi-container setups, set the `NETBIRD_STORE_CONFIG_ENGINE` environment variable in `setup.env` to `postgres` to enable PostgreSQL. ```bash NETBIRD_STORE_CONFIG_ENGINE=postgres ``` -------------------------------- ### Get Instance Status Source: https://docs.netbird.io/api/resources/instance Retrieves the current status of the NetBird instance, indicating if initial setup is required. This endpoint is unauthenticated. ```curl curl -X GET https://api.netbird.io/api/instance \ -H 'Accept: application/json' \ -H 'Authorization: Token ' ``` -------------------------------- ### Example Output of Debug Bundle Upload Source: https://docs.netbird.io/help/troubleshooting-client This example shows the typical output when generating and uploading a debug bundle, including the local file path and the upload file key. ```text netbird debug bundle --system-info --upload-bundle Local file: /tmp/netbird.debug.2611377582.zip Upload file key: 1234567890ab27fb37c88b3b4be7011e22aa2e5ca6f38ffa9c4481884941f726/12345678-90ab-cdef-1234-567890abcdef ```