Nebula Documentation
website·Indexed 34 days ago
https://nebula.defined.net/docs/Documentation for Nebula, a scalable overlay networking tool. Includes guides on NAT traversal, lighthouse discovery, PKI configuration, firewall security groups, and relay support introduced in v1.6.0. Covers configuration for TUN interfaces, SSH debugging consoles, and Prometheus stats integration.
What's inside Nebula
- Nebula is a self-hosted, peer-to-peer, layer 3 virtual overlay network designed for speed, security, and scalability. It creates on-demand, encrypted tunnels between hosts across any IP network without requiring open firewall ports. It supports TCP, UDP, and ICMP traffic via a TUN adapter with split-tunneling and utilizes the Noise Protocol Framework for mutual authentication.
Overview of Nebula unsafe_routes for subnet routing
Theunsafe_routesfeature allows Nebula to route traffic destined for a specific local subnet through a specific host on the overlay network. This enables remote access to devices on a physical LAN (e.g., printers, proprietary hardware) that cannot have the Nebula agent installed.Define local network range hints using local_range
Thelocal_rangeconfiguration option is used to define a hint about the local network range. This helps the system speed up the discovery of the fastest path to a Nebula node that is network-adjacent. Note thatlocal_rangeis deprecated in favor ofpreferred_ranges.local_range: '172.16.0.0/24'Understand Nebula network components
A Nebula network consists of three primary components:
- Lighthouse: A specialized Nebula host that tracks all other hosts in the network and helps them discover each other.
- Certificate Authority (CA): Consists of a CA certificate (distributed to all hosts) and a private key (kept secret/offline). The CA is used to sign keys for every host added to the network to ensure trust and prevent impersonation.
- Hosts: Any node in the network (server, laptop, mobile device). Each host has a unique certificate (containing name, IP, and group membership) and a private key used to validate identity when creating tunnels.
Prerequisites for configuring unsafe_routes
To configure subnet routing via
unsafe_routes, you need:- A working Nebula overlay network with a lighthouse and at least two hosts: one Linux host acting as the router and one client host (Linux, macOS, or Windows).
- The
nebula-certbinary for signing certificates. - The
ca.keyandca.crtfiles for the overlay network. - Root access to the Linux router host and the client host.
- A CA capable of signing certificates with subnets. If the CA was created without the
-subnetsflag, it is compatible. You can verify this by runningnebula-cert print -path ca.crtand checking if theSubnetsfield is empty or contains the target CIDR.
nebula-cert print -json -path ca.crt | jq .detailsUse PKCS11 for private key storage
Starting in v1.10, Nebula supports using a PKCS11 URL to reference a private key stored in an HSM.
Prerequisites:
- Nebula must be built from source with
cgoandpkcs11tags (e.g., usingmake bin-pkcs11). - Only P256 is supported; Curve25519 is not supported via PKCS11.
- The key must be uniquely identifiable via
idandobjectparameters. - The key's
CKA_DERIVEattribute must beCK_TRUE. - Derivations must be possible via the
CKM_ECDH1_DERIVEmechanism. - The HSM must allow the derivation output to be extracted (
CKA_EXTRACTABLE == CK_TRUE).
pki: # Reference pin via file key: 'pkcs11:id=1234;object=nebula%20key?module-path=/usr/lib64/pkcs11/my-module.so&pin-source=/path/to/pin-file' # OR specify the pin directly # key: "pkcs11:id=1234;object=nebula%20key?module-path=/usr/lib64/pkcs11/my-module.so&pin-value=1234"- Nebula must be built from source with
View Nebula logs on Android and iOS
In the mobile app, select the specific site and tap 'View Logs' on the site details page. Note that logs are cleared every time a site is started.Route traffic to non-Nebula nodes using unsafe routes
Unsafe routes allow routing traffic over Nebula to hosts or services that cannot run the Nebula agent.
Critical Requirement: The Nebula certificate of the
vianode MUST have the targetroutedefined in its subnets list, otherwise traffic will be silently refused.tun: unsafe_routes: - route: 172.16.1.0/24 via: 192.168.100.99 mtu: 1300 metric: 100 install: true # Whether to install this route in the system routing tableUpgrade Nebula hosts to support v2 certificates and IPv6
To enable IPv6 support and v2 certificate formats, all hosts in the network must be upgraded to Nebula v1.10 or later. Older versions cannot validate v2 certificates. This upgrade must be completed across all hosts before proceeding with the certificate migration.Clean up after v2 certificate migration
Once all hosts are migrated to v2 certificates and the network is stable, perform the following cleanup to remove legacy v1 dependencies:
- Remove the v1 CA certificate from the
pki.catrust bundle on all hosts. - Reload Nebula on all hosts.
- Delete any backup files containing v1 certificates and keys.
- Remove the v1 CA certificate from the
Create a dedicated system user for Nebula
To improve security on Linux, run Nebula as a dedicated unprivileged system user instead of root. This limits the impact of a potential compromise. You must create the user and ensure they own the configuration directory with restricted permissions to protect private keys and CA material.sudo useradd --system --shell /usr/sbin/nologin nebula sudo chown -R nebula:nebula /etc/nebula sudo chmod 0700 /etc/nebulaView Nebula logs and service status on macOS
For installations using Homebrew on Apple Silicon, logs are stored in/opt/homebrew/var/log/nebula.*. On Intel processors, the default prefix is/usr/local. You can view logs via the terminal or by opening/opt/homebrew/var/log/nebula.login the Console.app (use Cmd + Shift + G in the file picker to enter the path).# Follow Nebula logs sudo tail -f /opt/homebrew/var/log/nebula.* # Check Nebula service status launchctl list homebrew.mxcl.nebula