[GH-ISSUE #4108] Add a network in allowed ips, but do not add route for it #8085

Open
opened 2026-08-05 01:15:55 -04:00 by saavagebueno · 5 comments
Owner

Originally created by @ZnqbuZ on GitHub (Jul 5, 2025).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/4108

Is your feature request related to a problem? Please describe.
Need to set up conditional route on a gateway connected with NetBird. Only traffic from some machines should be route to NetBird.

Describe the solution you'd like
Just add an option for each network to disable automatically route adding.
And add a global option to totally disable route modifications.

Describe alternatives you've considered
Manually remove table netbird

Originally created by @ZnqbuZ on GitHub (Jul 5, 2025). Original GitHub issue: https://github.com/netbirdio/netbird/issues/4108 **Is your feature request related to a problem? Please describe.** Need to set up conditional route on a gateway connected with NetBird. Only traffic from some machines should be route to NetBird. **Describe the solution you'd like** Just add an option for each network to disable automatically route adding. And add a global option to totally disable route modifications. **Describe alternatives you've considered** Manually remove table netbird
saavagebueno added the feature-requestclientnetworking labels 2026-08-05 01:15:55 -04:00
Author
Owner

@ZnqbuZ commented on GitHub (Jul 5, 2025):

Probably related https://github.com/netbirdio/netbird/issues/3984

<!-- gh-comment-id:3039836162 --> @ZnqbuZ commented on GitHub (Jul 5, 2025): Probably related https://github.com/netbirdio/netbird/issues/3984
Author
Owner

@nazarewk commented on GitHub (Jul 7, 2025):

I am not sure I follow, could you elaborate?

What kind of routes are we talking about? Network Resource or Network Route? How do you have it configured?

If I understand it correctly, creating a Network Resource at GroupA, then creating a Policy giving access from GroupB to GroupA and then assigning GroupB to a single Peer would only allow that Peer to access the configured Resource.

<!-- gh-comment-id:3044707497 --> @nazarewk commented on GitHub (Jul 7, 2025): I am not sure I follow, could you elaborate? What kind of routes are we talking about? Network Resource or Network Route? How do you have it configured? If I understand it correctly, creating a Network Resource at `GroupA`, then creating a Policy giving access from `GroupB` to `GroupA` and then assigning `GroupB` to a single Peer would only allow that Peer to access the configured Resource.
Author
Owner

@ZnqbuZ commented on GitHub (Jul 8, 2025):

It's the route table on the gateway machine. In brief, I want a Table=off or Table = <Some Table>, see this

To be precise, I want an option like "Add route to machines or not" when I choose the distribution group. For example, say that I have 2 nodes A and B in netbird, (where A is the gateway I mentioned,) and I let B to be an exit node of A. Then on A, I can see that 0.0.0.0/0 is in AllowedIPs of <B>, and ip route show tables all & ip rule show indicates that I have a route equivalent to default via <B>. Now I want netbird not to add this default route: imagine that I have a container C on A and I want A to route traffic from C to B, but not to route traffic from itself to B.

Image
<!-- gh-comment-id:3048149761 --> @ZnqbuZ commented on GitHub (Jul 8, 2025): It's the route table on the gateway machine. In brief, I want a `Table=off` or `Table = <Some Table>`, see [this](https://github.com/pirate/wireguard-docs?tab=readme-ov-file#Table) To be precise, I want an option like "Add route to machines or not" when I choose the distribution group. For example, say that I have 2 nodes `A` and `B` in netbird, (where `A` is the gateway I mentioned,) and I let `B` to be an exit node of `A`. Then on `A`, I can see that `0.0.0.0/0` is in `AllowedIPs` of `<B>`, and `ip route show tables all` & `ip rule show` indicates that I have a route equivalent to `default via <B>`. Now I want netbird not to add this default route: imagine that I have a container `C` on `A` and I want `A` to route traffic from `C` to `B`, but not to route traffic from itself to `B`. <img width="1237" height="258" alt="Image" src="https://github.com/user-attachments/assets/06f8c78a-5082-457e-9acf-5c8039a0fc14" />
Author
Owner

@QuantumCorral commented on GitHub (Nov 9, 2025):

+1

<!-- gh-comment-id:3508449334 --> @QuantumCorral commented on GitHub (Nov 9, 2025): +1
Author
Owner

@SEsternO commented on GitHub (Jun 28, 2026):

+1.

I wanted to use netbird on one of my old shorewall-based (iptables frontend) firewall to set up an existing in netbird exit node for policy-based routing on said shorewall machine.

For the client on this old firewall I set NB_USE_LEGACY_ROUTING=true variable to skip creating netbird rule table that inserts itself before other tables and interferes with shorewall tables for policy-based routing, and set --disable-firewall since I do all the firewalling manually.

The issue is, now I have 0.0.0.0/1 and 128.0.0.0/1 routes in my main routing table. Not only that, all routes with src addresses from the exit node are now getting discovered and placed into the main routing table of the old firewall with these src addresses via the main gateway and interface, which is maybe normal for the separate netbird table, but also probably shouldn't happen in the main table, looks like this:

# exit node

...
192.168.5.0/24 dev macvlan805 proto kernel scope link src 192.168.5.254 
192.168.9.0/24 dev macvlan809 proto kernel scope link src 192.168.9.254 
192.168.13.0/24 dev macvlan813 proto kernel scope link src 192.168.13.254 
...
# old firewall

0.0.0.0/1 dev wt0 
128.0.0.0/1 dev wt0 
...
192.168.5.254 via 11.22.33.44 dev ppp0 
192.168.9.254 via 11.22.33.44 dev ppp0 
192.168.13.254 via 11.22.33.44 dev ppp0 
...

One way I found how to disable all these routes on the old firewall machine (excluding the main netbird /16 network route, which is perfect), is to set the client to --disable-client-routes. However, this also removes the 0.0.0.0/0 from allowed ips on the wireguard interface, which prevents all the external IPs routing through the exit node on the old firewall.

TL;DR: I would also like an option to skip creating the routes on the client while preserving allowed ips on the wireguard interface itself. Essentially what it comes to for me is having almost raw wireguard interface to do as I see fit with, while also having it connected to the main netbird system with all its magic 😄

<!-- gh-comment-id:4826560697 --> @SEsternO commented on GitHub (Jun 28, 2026): +1. I wanted to use netbird on one of my old shorewall-based (iptables frontend) firewall to set up an existing in netbird exit node for policy-based routing on said shorewall machine. For the client on this old firewall I set `NB_USE_LEGACY_ROUTING=true` variable to skip creating netbird rule table that inserts itself before other tables and interferes with shorewall tables for policy-based routing, and set `--disable-firewall` since I do all the firewalling manually. The issue is, now I have `0.0.0.0/1` and `128.0.0.0/1` routes in my `main` routing table. Not only that, all routes with src addresses from the exit node are now getting discovered and placed into the main routing table of the old firewall with these src addresses via the main gateway and interface, which is maybe normal for the separate netbird table, but also probably shouldn't happen in the main table, looks like this: ``` # exit node ... 192.168.5.0/24 dev macvlan805 proto kernel scope link src 192.168.5.254 192.168.9.0/24 dev macvlan809 proto kernel scope link src 192.168.9.254 192.168.13.0/24 dev macvlan813 proto kernel scope link src 192.168.13.254 ... ``` ``` # old firewall 0.0.0.0/1 dev wt0 128.0.0.0/1 dev wt0 ... 192.168.5.254 via 11.22.33.44 dev ppp0 192.168.9.254 via 11.22.33.44 dev ppp0 192.168.13.254 via 11.22.33.44 dev ppp0 ... ``` One way I found how to disable all these routes on the old firewall machine (excluding the main netbird /16 network route, which is perfect), is to set the client to `--disable-client-routes`. However, this also removes the `0.0.0.0/0` from allowed ips on the wireguard interface, which prevents all the external IPs routing through the exit node on the old firewall. TL;DR: I would also like an option to skip creating the routes on the client while preserving allowed ips on the wireguard interface itself. Essentially what it comes to for me is having almost raw wireguard interface to do as I see fit with, while also having it connected to the main netbird system with all its magic 😄
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#8085