Skip to main content

Routes

NetBird routes enable peers to access networks and resources that aren’t directly part of your NetBird mesh network. By designating specific peers as routing peers (or exit nodes), you can route traffic to external networks, cloud VPCs, on-premise networks, or even the entire internet.

How Routes Work

Routes define network prefixes or domains that should be accessible through designated routing peers:
The routing peer acts as a gateway, forwarding traffic from NetBird peers to the external network and routing responses back.

Route Structure

A NetBird route contains:

Network Types

NetBird supports three types of routes:

IPv4 Routes

Static routes to IPv4 networks:
Example use cases:
  • Access to on-premise office network
  • Cloud VPC routing
  • Private subnet access

IPv6 Routes

Static routes to IPv6 networks:

Dynamic Domain Routes

Routes based on domain names (DNS-based routing):
NetBird resolves these domains dynamically and routes traffic accordingly.
Routes can specify either a network prefix OR domains, but not both. For domain routes, the network field is set to a placeholder IP (192.0.2.0/32) internally.

Route Configuration

Basic Route Parameters

A human-readable identifier for the route (1-40 characters):
Examples:
  • "office-network"
  • "aws-vpc-production"
  • "internet-exit-node"
The NetID is used for identifying and grouping related routes.
Define what network or domains this route covers:For static networks:
For dynamic domains:
The network must be a valid CIDR notation (e.g., 192.168.1.0/24, 10.0.0.0/8).
Specify which peer(s) will act as gateways:Single peer:
Multiple peers via groups (high availability):
You can specify either a single peer OR peer groups, but not both. Using peer groups enables automatic failover if one routing peer goes offline.
Enable Network Address Translation on the routing peer:
When enabled:
  • The routing peer performs source NAT
  • External networks see traffic coming from the routing peer’s IP
  • Required when the external network doesn’t have routes back to NetBird peers
When disabled:
  • Traffic keeps the original source IP
  • External network must have routes back to NetBird IPs
  • Better for logging and access control on the external network
Route priority when multiple routes exist for the same destination:
Lower values = higher priorityExample:
Control which peers receive this route:
Only peers in these groups will have the route installed on their devices. This allows you to:
  • Limit route distribution to specific teams
  • Create different routing policies for different user groups
  • Reduce routing table size on peers that don’t need the route
Additional access control on top of distribution:
Access control groups further restrict which peers can actually use the route, even if they receive it.

Creating Routes

Route Examples

Office Network Access

Cloud VPC Routing

Internet Exit Node

Domain-Based Routing

High Availability Setup

Route Validation

NetBird validates routes to prevent conflicts:
Validation checks:
  1. Metric range: Must be between 1 and 9999
  2. NetID length: Must be 1-40 characters
  3. Network or domains: Must specify one, but not both
  4. Valid CIDR: Network must be a valid prefix
  5. Peer XOR groups: Cannot specify both peer and peer groups
  6. Group existence: All referenced groups must exist
  7. No duplicates: Same prefix cannot be assigned to overlapping peers

Preventing Duplicate Routes

NetBird prevents creating multiple routes with the same network/domains on the same peer:
This ensures:
  • No peer has duplicate routes for the same network
  • No peer group members have conflicting routes
  • High availability setups are properly configured

Route Status and Keep Route

The KeepRoute setting controls route behavior when the routing peer goes offline:
When KeepRoute is true, client devices will continue trying to route traffic through the offline peer, causing connectivity failures until the peer comes back online or the route is disabled.

High Availability Routing

Using peer groups for routing enables automatic failover:
Behavior:
  • All peers in the group advertise the route
  • Client peers choose based on connectivity and metric
  • If primary fails, traffic automatically fails over to backup
  • When primary recovers, it becomes available again
This provides redundancy without manual intervention.

Exit Nodes (Internet Routing)

An exit node routes all internet traffic through a NetBird peer:
Common use cases:
  • Bypass geographic restrictions
  • Route mobile devices through a secure gateway
  • Access region-specific services
  • Centralize internet filtering

Exit Node Configuration

The SkipAutoApply setting controls whether client applications automatically use the exit node or require manual activation.

Route Metrics and Priority

When multiple routes match a destination, NetBird uses the metric to determine priority:
Priority is determined by:
  1. Most specific prefix (longest prefix match)
  2. Lowest metric (if prefix lengths are equal)
NetBird uses standard routing table logic. More specific routes (longer prefix) always take precedence over less specific routes, regardless of metric.

Route Activity Events

All route operations are logged:
  • RouteCreated: New route created
  • RouteUpdated: Route modified
  • RouteRemoved: Route deleted
Event metadata:

Routing Peer Requirements

For a peer to act as a routing peer, it must:
  1. Have IP forwarding enabled on the operating system
  2. Have network access to the destination network
  3. Be connected to the NetBird network
  4. Have proper firewall rules allowing forwarding
On Linux:

Route Best Practices

Choose meaningful identifiers that explain the route’s purpose:✅ Good:
  • "aws-vpc-production"
  • "office-network-london"
  • "datacenter-dmz"
❌ Bad:
  • "route1"
  • "network"
  • "test"
Use masquerade when:
  • The external network doesn’t have return routes to NetBird IPs
  • Routing to the internet (exit nodes)
  • External network uses strict firewall rules
Disable masquerade when:
  • You want to preserve source IPs for logging
  • The external network has proper return routes
  • You need end-to-end visibility
For critical routes, use peer groups instead of single peers:
This provides automatic failover and better reliability.
Organize routes with logical metric values:
This makes route priority clear and easier to manage.
Only distribute routes to peers that need them:
This reduces routing table size and improves performance.

API Reference

Key route management functions: