[GH-ISSUE #840] network route not working for subnetwork even if it should have to work #1357

Open
opened 2026-08-05 00:42:11 -04:00 by saavagebueno · 0 comments
Owner

Originally created by @lfarkas on GitHub (May 8, 2023).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/840

The network routes is a very nice feature in netbird, but one of my current topology it's not working.
I've 2 network, let it be office and home:

  • office 192.168.0.0/16
  • home 192.168.253/24

I've one client (actually more but let's make it more simple) in each network and i'd like route through these client from each network to the other. This normally works (eg with openvpn) and it's works even with netbird,
BUT do not work if i set both routes in https://app.netbird.io/routes and try to advertise them through netbird.

The reason is simple from the log:

2023-05-08T12:50:55+02:00 INFO client/internal/peer/conn.go:348: connected to peer gsrpCbJwc8lkmNV783rxIHpyj+zZIhy/rFj5HsfVuBY= [laddr <-> raddr] [192.168.209.150:51820 <-> 192.168.209.1:38584]
2023-05-08T12:50:55+02:00 INFO client/internal/routemanager/client.go:111: new chosen route is chccqaat2r9s73b1k4q0 with peer gsrpCbJwc8lkmNV783rxIHpyj+zZIhy/rFj5HsfVuBY= with score 11
2023-05-08T12:50:55+02:00 WARN client/internal/routemanager/systemops_nonandroid.go:27: skipping adding a new route for network 192.168.253.0/24 because it already exists and is pointing to the non default gateway: 192.168.209.150

it seems that netbird see something similar route in the local routing table and skip this, which is a bug. in linux (any any other os) the routing decision is working in a way that always try to choose the smallest network which contains the given destination. so in this case there can be 2 orverlapping route in the routing table the os always choose the smallest one eg. with this routing table:

192.168.0.0     0.0.0.0         255.255.0.0     U     100    0        0 enp2s0
192.168.253.0     100.76.24.179   255.255.255.0     UG    0      0        0 wt0

the host 192.168.253.2 should have to route through wt0.

The strange thing is that the opposite works in the other side of the network. ie. routeing from home to office has this routing table:

0.0.0.0         192.168.253.1   0.0.0.0         UG    100    0        0 enp6s0
100.76.0.0      0.0.0.0         255.255.0.0     U     0      0        0 wt0
192.168.0.0     100.76.24.179   255.255.0.0     UG    0      0        0 wt0
192.168.253.0   0.0.0.0         255.255.255.0   U     100    0        0 enp6s0

and in the log:

2023-05-08T12:50:55+02:00 INFO client/internal/peer/conn.go:348: connected to peer hCDjKQBW9TBwsZigTRXxvVzpAYE+ZqDHBol4sOSUMl0= [laddr <-> raddr] [192.168.253.9:51820 <-> 185.199.30.141:2563]
2023-05-08T12:50:55+02:00 INFO client/internal/routemanager/client.go:111: new chosen route is cgva4m2t2r9s73c4r8tg with peer hCDjKQBW9TBwsZigTRXxvVzpAYE+ZqDHBol4sOSUMl0= with score 11

so when the remote is overlapping BUT larger then the routing rule is added.

Originally created by @lfarkas on GitHub (May 8, 2023). Original GitHub issue: https://github.com/netbirdio/netbird/issues/840 The network routes is a very nice feature in netbird, but one of my current topology it's not working. I've 2 network, let it be office and home: - office 192.168.0.0/16 - home 192.168.253/24 I've one client (actually more but let's make it more simple) in each network and i'd like route through these client from each network to the other. This normally works (eg with openvpn) and it's works even with netbird, BUT do not work if i set both routes in https://app.netbird.io/routes and try to advertise them through netbird. The reason is simple from the log: ``` 2023-05-08T12:50:55+02:00 INFO client/internal/peer/conn.go:348: connected to peer gsrpCbJwc8lkmNV783rxIHpyj+zZIhy/rFj5HsfVuBY= [laddr <-> raddr] [192.168.209.150:51820 <-> 192.168.209.1:38584] 2023-05-08T12:50:55+02:00 INFO client/internal/routemanager/client.go:111: new chosen route is chccqaat2r9s73b1k4q0 with peer gsrpCbJwc8lkmNV783rxIHpyj+zZIhy/rFj5HsfVuBY= with score 11 2023-05-08T12:50:55+02:00 WARN client/internal/routemanager/systemops_nonandroid.go:27: skipping adding a new route for network 192.168.253.0/24 because it already exists and is pointing to the non default gateway: 192.168.209.150 ``` it seems that netbird see something similar route in the local routing table and skip this, which is a bug. in linux (any any other os) the routing decision is working in a way that always try to choose the smallest network which contains the given destination. so in this case there can be 2 orverlapping route in the routing table the os always choose the smallest one eg. with this routing table: ``` 192.168.0.0 0.0.0.0 255.255.0.0 U 100 0 0 enp2s0 192.168.253.0 100.76.24.179 255.255.255.0 UG 0 0 0 wt0 ``` the host 192.168.253.2 should have to route through wt0. The strange thing is that the opposite works in the other side of the network. ie. routeing from home to office has this routing table: ``` 0.0.0.0 192.168.253.1 0.0.0.0 UG 100 0 0 enp6s0 100.76.0.0 0.0.0.0 255.255.0.0 U 0 0 0 wt0 192.168.0.0 100.76.24.179 255.255.0.0 UG 0 0 0 wt0 192.168.253.0 0.0.0.0 255.255.255.0 U 100 0 0 enp6s0 ``` and in the log: ``` 2023-05-08T12:50:55+02:00 INFO client/internal/peer/conn.go:348: connected to peer hCDjKQBW9TBwsZigTRXxvVzpAYE+ZqDHBol4sOSUMl0= [laddr <-> raddr] [192.168.253.9:51820 <-> 185.199.30.141:2563] 2023-05-08T12:50:55+02:00 INFO client/internal/routemanager/client.go:111: new chosen route is cgva4m2t2r9s73c4r8tg with peer hCDjKQBW9TBwsZigTRXxvVzpAYE+ZqDHBol4sOSUMl0= with score 11 ``` so when the remote is overlapping BUT larger then the routing rule is added.
saavagebueno added the waiting-feedback label 2026-08-05 00:42:11 -04:00
Sign in to join this conversation.
No Label waiting-feedback
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#1357