[GH-ISSUE #3523] Route only specific Ports or Domains to Exit Nodes #7498

Open
opened 2026-08-05 01:13:13 -04:00 by saavagebueno · 4 comments
Owner

Originally created by @fre4ki on GitHub (Mar 17, 2025).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/3523

Is your feature request related to a problem? Please describe.
When i'm configuring Exit Nodes all Traffic will be going out to the Exit Nodes. Local-Routing to other Local-Networks are impossible. I have to disconnect the Netbird Agent and then the traffic will be going to my Default-Gateway.

Describe the solution you'd like
Only specific Ports and/or Domain-Names should be routed to the Exit Nodes.

f. e.
Port 22/tcp to all destinations
Port 443 to destinations with Hostname fw.domain.com

Maybe some-way is to select the Exit Nodes on the Policy's. Create on Destinations a new entry "External" and then show a new Tab where we can enter the FQDNs/Servers.

I think this would be a nice solution for all of us.

Originally created by @fre4ki on GitHub (Mar 17, 2025). Original GitHub issue: https://github.com/netbirdio/netbird/issues/3523 **Is your feature request related to a problem? Please describe.** When i'm configuring Exit Nodes all Traffic will be going out to the Exit Nodes. Local-Routing to other Local-Networks are impossible. I have to disconnect the Netbird Agent and then the traffic will be going to my Default-Gateway. **Describe the solution you'd like** Only specific Ports and/or Domain-Names should be routed to the Exit Nodes. f. e. Port 22/tcp to all destinations Port 443 to destinations with Hostname fw.domain.com Maybe some-way is to select the Exit Nodes on the Policy's. Create on Destinations a new entry "External" and then show a new Tab where we can enter the FQDNs/Servers. I think this would be a nice solution for all of us.
saavagebueno added the feature-requestclientnetworking labels 2026-08-05 01:13:14 -04:00
Author
Owner

@maquis196 commented on GitHub (May 11, 2025):

I thought I had this working with no exit node configured, I was wrong, just netbird being very slow.

The only nice way around this that ive discovered is to set up a local exit node with lower priority than the other one you need for routing stuff.

which is far from ideal, should easily just be a button that enables "all traffic unless routed elsewhere" and "only select routes"

<!-- gh-comment-id:2869951312 --> @maquis196 commented on GitHub (May 11, 2025): I thought I had this working with no exit node configured, I was wrong, just netbird being very slow. The only nice way around this that ive discovered is to set up a local exit node with lower priority than the other one you need for routing stuff. which is far from ideal, should easily just be a button that enables "all traffic unless routed elsewhere" and "only select routes"
Author
Owner

@dmdhrumilmistry commented on GitHub (Jun 13, 2025):

Is your feature request related to a problem? Please describe. When i'm configuring Exit Nodes all Traffic will be going out to the Exit Nodes. Local-Routing to other Local-Networks are impossible. I have to disconnect the Netbird Agent and then the traffic will be going to my Default-Gateway.

Describe the solution you'd like Only specific Ports and/or Domain-Names should be routed to the Exit Nodes.

f. e. Port 22/tcp to all destinations Port 443 to destinations with Hostname fw.domain.com

Maybe some-way is to select the Exit Nodes on the Policy's. Create on Destinations a new entry "External" and then show a new Tab where we can enter the FQDNs/Servers.

I think this would be a nice solution for all of us.

Even I'm looking forward for this feature for domains

<!-- gh-comment-id:2969124600 --> @dmdhrumilmistry commented on GitHub (Jun 13, 2025): > **Is your feature request related to a problem? Please describe.** When i'm configuring Exit Nodes all Traffic will be going out to the Exit Nodes. Local-Routing to other Local-Networks are impossible. I have to disconnect the Netbird Agent and then the traffic will be going to my Default-Gateway. > > **Describe the solution you'd like** Only specific Ports and/or Domain-Names should be routed to the Exit Nodes. > > f. e. Port 22/tcp to all destinations Port 443 to destinations with Hostname fw.domain.com > > Maybe some-way is to select the Exit Nodes on the Policy's. Create on Destinations a new entry "External" and then show a new Tab where we can enter the FQDNs/Servers. > > I think this would be a nice solution for all of us. Even I'm looking forward for this feature for domains
Author
Owner

@dmdhrumilmistry commented on GitHub (Jun 13, 2025):

I thought I had this working with no exit node configured, I was wrong, just netbird being very slow.

The only nice way around this that ive discovered is to set up a local exit node with lower priority than the other one you need for routing stuff.

which is far from ideal, should easily just be a button that enables "all traffic unless routed elsewhere" and "only select routes"

@fre4ki have you tried this method? Is it working?

<!-- gh-comment-id:2969125140 --> @dmdhrumilmistry commented on GitHub (Jun 13, 2025): > I thought I had this working with no exit node configured, I was wrong, just netbird being very slow. > > The only nice way around this that ive discovered is to set up a local exit node with lower priority than the other one you need for routing stuff. > > which is far from ideal, should easily just be a button that enables "all traffic unless routed elsewhere" and "only select routes" @fre4ki have you tried this method? Is it working?
Author
Owner

@nazarewk commented on GitHub (Jun 13, 2025):

I don't think it's possible to route ports to different destinations on the operating-system level: routing is done on IP addresses in Layer 3, while ports are Layer 4 and access whatever was already routed.
It might be possible if the local client acted as a proxy, but it would involve additional filtering/routing load on the client.
It's not much different from the requirement of using a reverse HTTP proxy (Layer 7) or TLS passthrough proxy (Layer 6) to distinguish between different domains running on the same IP address and port.

Maybe something could be done in terms of excluding LAN routes, but normally it should "just work" as long as the router is advertising correct LAN routes.

The Exit Node/default route points to 0.0.0.0/0 (the least specific set possible), while LAN routes are more specific (eg: /24) and will always take priority.
This is also why some VPNs split the "default route" into a more specific 0.0.0.0/1 & 128.0.0.0/1 pair to give it higher priority instead of addressing those with a metric parameter. Lower metrics give priority on routing collisions: out of multiple routes for exactly the same IP range the one with lowest metric will be chosen.

<!-- gh-comment-id:2969322712 --> @nazarewk commented on GitHub (Jun 13, 2025): I don't think it's possible to route **ports** to different destinations on the operating-system level: routing is done on IP addresses in Layer 3, while ports are Layer 4 and access whatever was _already routed_. It **might** be possible if the local client acted as a proxy, but it would involve additional filtering/routing load on the client. It's not much different from the requirement of using a reverse HTTP proxy (Layer 7) or TLS passthrough proxy (Layer 6) to distinguish between different domains running on the same IP address and port. Maybe something could be done in terms of excluding LAN routes, but normally it should "just work" as long as the router is advertising correct LAN routes. The Exit Node/default route points to 0.0.0.0/0 (the least specific set possible), while LAN routes are more specific (eg: `/24`) and will always take priority. This is also why some VPNs split the "default route" into a more specific `0.0.0.0/1` & `128.0.0.0/1` pair to give it higher priority instead of addressing those with a `metric` parameter. Lower metrics give priority on routing collisions: out of multiple routes for **exactly** the same IP range the one with lowest `metric` will be chosen.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#7498