Skip to content

Nebula: building an overlay mesh from Slack's open source

How we install Nebula, structure the lighthouse, and write certificate-bound firewall rules — a deep look at Slack's open-source overlay VPN in production.

Nebula is the overlay mesh Slack open-sourced after running it internally — small Go binary, certificate-bound identity, lighthouse-based discovery, and a host-firewall model baked into the protocol. We use it where Tailscale would be a good fit but the client cannot send identity metadata to a third party, and where Headscale’s MongoDB-shaped operational footprint is too heavy. This article covers the install, the CA bootstrap, lighthouse topology, and how to write firewall rules that survive a fleet scale-up.

How to verify

Before installing, confirm UDP 4242 is reachable from the lighthouse to every host, and you have a clean directory for the certificate authority.

ss -unp | grep :4242
ls -l /etc/nebula 2>/dev/null
ip route show default
sysctl net.ipv4.ip_forward

If /etc/nebula already exists from a previous attempt, audit what is in it. Old host.crt / host.key from a different CA will silently fail to handshake and emit cryptic “certificate not signed by ca” errors.

What’s happening

Nebula has three roles:

  • Certificate Authority — a private key + cert that signs every node’s identity. Lives offline in serious deployments; you keep the .key archived.
  • Lighthouse — a node with a public IP that other nodes register with for discovery. Stateless, runs the same nebula binary with a flag.
  • Host — every other node. Holds its own cert, talks to the lighthouse for peer lookup, then establishes direct UDP tunnels with hole-punched peers.

The protocol is Noise-IK, similar to WireGuard, with one critical addition: every host certificate carries a list of groups and an IP. The firewall section of config.yaml writes rules in terms of those groups (allow groups: web-server). When a peer presents its cert, Nebula checks the rules and enforces them at the data plane. Compromise a single host and the attacker can only reach what that host’s cert was allowed to reach.

This is the model’s strength: identity is baked into the cryptographic primitive. There is no separate ACL evaluation step that can drift from the cert.

The procedure

  1. Install the binary on every node including the lighthouse.

    NEBULA_VER=v1.9.4
    curl -fsSL https://github.com/slackhq/nebula/releases/download/${NEBULA_VER}/nebula-linux-amd64.tar.gz | \
      tar -xz -C /usr/local/bin nebula nebula-cert
    nebula -version
  2. Bootstrap the CA on an isolated admin host. Never on the lighthouse.

    mkdir -p ca && cd ca
    nebula-cert ca -name "example-corp"
    ls -la
    # ca.crt  ca.key
    chmod 600 ca.key

    ca.key does not return to the fleet; it stays archived offline.

  3. Issue a lighthouse certificate.

    nebula-cert sign -name "lighthouse-1" -ip "192.168.100.1/24" -groups "lighthouse"
  4. Issue host certs with their groups baked in:

    nebula-cert sign -name "web-1" -ip "192.168.100.10/24" -groups "web-server"
    nebula-cert sign -name "db-1"  -ip "192.168.100.20/24" -groups "db-server"
    nebula-cert sign -name "alice" -ip "192.168.100.50/24" -groups "engineer"
  5. Write /etc/nebula/config.yaml on the lighthouse.

    pki:
      ca:   /etc/nebula/ca.crt
      cert: /etc/nebula/lighthouse-1.crt
      key:  /etc/nebula/lighthouse-1.key
    
    static_host_map: {}
    
    lighthouse:
      am_lighthouse: true
      interval: 60
    
    listen:
      host: 0.0.0.0
      port: 4242
    
    punchy:
      punch: true
    
    tun:
      dev: nebula1
      drop_local_broadcast: true
      drop_multicast: true
      tx_queue: 500
      mtu: 1300
    
    firewall:
      conntrack:
        tcp_timeout: 12m
        udp_timeout: 3m
      outbound:
        - port: any
          proto: any
          host: any
      inbound:
        - port: any
          proto: icmp
          host: any
  6. Write host config — the structural difference is am_lighthouse: false plus the static_host_map pointing at lighthouses by their overlay IP -> public endpoint:

    static_host_map:
      "192.168.100.1": ["lh-1.public.example.org:4242"]
    
    lighthouse:
      am_lighthouse: false
      hosts:
        - "192.168.100.1"
    
    firewall:
      outbound:
        - port: any
          proto: any
          host: any
      inbound:
        # Engineers can ssh into web servers.
        - port: 22
          proto: tcp
          groups: ["engineer"]
        # Web servers can talk to db servers on Postgres.
        - port: 5432
          proto: tcp
          groups: ["web-server"]
        # ICMP allowed for ping/diag.
        - port: any
          proto: icmp
          host: any

    Drop ca.crt, <host>.crt, and <host>.key into /etc/nebula/. Permissions: chmod 600 on the key.

  7. Run it as a systemd unit. A sample unit you can drop in:

    [Unit]
    Description=Nebula overlay network
    Wants=basic.target
    After=basic.target network.target
    
    [Service]
    SyslogIdentifier=nebula
    ExecReload=/bin/kill -HUP $MAINPID
    ExecStart=/usr/local/bin/nebula -config /etc/nebula/config.yaml
    Restart=always
    
    [Install]
    WantedBy=multi-user.target

    systemctl enable --now nebula.

  8. Verify the mesh.

    ip addr show nebula1
    ping 192.168.100.1
    ss -unp | grep :4242
    journalctl -u nebula -e --no-pager | tail -50

Operational notes

  • Cert lifetimes default to one year. Plan rotation: nebula-cert sign with the same -name and -ip on the CA host, ship the new cert to the node, reload Nebula.
  • The lighthouse is critical for discovery but not for data — once peers know each other, the lighthouse can be down for hours and existing tunnels stay up.
  • Group strings in cert SANs are case-sensitive and not validated against any schema. Adopt a naming convention early or you will have webserver and web-server certs roaming the fleet.
  • Nebula’s firewall is stateful by default for TCP and UDP but not for ICMP — be explicit about ICMP rules or you will lose ping while connections work.
  • Logs are JSON-shaped and noisy. Pipe to Loki and add structured filters early; raw journalctl -u nebula is unreadable at scale.

In the engagements we run, Nebula fits clients with strict data-residency requirements who want a Tailscale-like mesh without sending metadata off-premise. Pair it with the operational rigor of a Managed Operations engagement and you get a mesh that scales without surprise outages — cert rotation, lighthouse HA, and on-call coverage included.