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:Route Structure
A NetBird route contains:Network Types
NetBird supports three types of routes:IPv4 Routes
Static routes to IPv4 networks:- 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):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
Network Identifier (NetID)
Network Identifier (NetID)
A human-readable identifier for the route (1-40 characters):Examples:
"office-network""aws-vpc-production""internet-exit-node"
Network or Domains
Network or Domains
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).Routing Peer or Peer Groups
Routing Peer or Peer Groups
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.
Masquerade (NAT)
Masquerade (NAT)
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
- 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
Metric (Priority)
Metric (Priority)
Route priority when multiple routes exist for the same destination:Lower values = higher priorityExample:
Distribution Groups
Distribution Groups
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
Access Control Groups
Access Control Groups
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:- Metric range: Must be between 1 and 9999
- NetID length: Must be 1-40 characters
- Network or domains: Must specify one, but not both
- Valid CIDR: Network must be a valid prefix
- Peer XOR groups: Cannot specify both peer and peer groups
- Group existence: All referenced groups must exist
- 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:- 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
TheKeepRoute setting controls route behavior when the routing peer goes offline:
High Availability Routing
Using peer groups for routing enables automatic failover:- 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
Exit Nodes (Internet Routing)
An exit node routes all internet traffic through a NetBird peer:- Bypass geographic restrictions
- Route mobile devices through a secure gateway
- Access region-specific services
- Centralize internet filtering
Exit Node Configuration
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:- Most specific prefix (longest prefix match)
- 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 createdRouteUpdated: Route modifiedRouteRemoved: Route deleted
Routing Peer Requirements
For a peer to act as a routing peer, it must:- Have IP forwarding enabled on the operating system
- Have network access to the destination network
- Be connected to the NetBird network
- Have proper firewall rules allowing forwarding
Route Best Practices
Use Descriptive NetIDs
Use Descriptive NetIDs
Choose meaningful identifiers that explain the route’s purpose:✅ Good:
"aws-vpc-production""office-network-london""datacenter-dmz"
"route1""network""test"
Enable Masquerade When Needed
Enable Masquerade When Needed
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
- You want to preserve source IPs for logging
- The external network has proper return routes
- You need end-to-end visibility
Use Peer Groups for Redundancy
Use Peer Groups for Redundancy
For critical routes, use peer groups instead of single peers:This provides automatic failover and better reliability.
Set Appropriate Metrics
Set Appropriate Metrics
Organize routes with logical metric values:This makes route priority clear and easier to manage.
Limit Distribution Groups
Limit Distribution Groups
Only distribute routes to peers that need them:This reduces routing table size and improves performance.
API Reference
Key route management functions:Related Resources
- Access Control - Overview of security model
- Groups - Organize peers for routing
- Policies - Control peer access
- DNS - Private DNS configuration