Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example to forward traffic through a netbird peer #133

Open
werlitong opened this issue Jan 21, 2024 · 0 comments
Open

Example to forward traffic through a netbird peer #133

werlitong opened this issue Jan 21, 2024 · 0 comments

Comments

@werlitong
Copy link

Scenario

Imagine that you have a two Peers (A and B). Peer A advertise 8.8.8.8/32 to Peer B through Netbird's network.

If we have hosts in Peer B's subnet that may want to talk to 8.8.8.8/32 through Peer A but they simple cant/dont want to install Netbird Client. We can forward traffic to Peer B instead.

I have managed to get this working by following these steps:

In peer B:

  1. run echo 1 > /proc/sys/net/ipv4/ip_forward or adding net.ipv4.ip_forward=1 to /etc/sysctl.conf.
  2. run iptables -t nat -A POSTROUTING -o netbird_interface -j MASQUERADE

Take note that netbird_interface is the interface from wireguard. Run route -n just to be sure.
image

In hosts that are in the same local subnet of Peer B:

  1. run route add 8.8.8.8 mask 255.255.255.255 ip_of_peer_B

In my case, it was easier to push that route (static route) in my router (UDM PRO from ubiquiti). By doing this all local clients (that dont have netbird) in my home network can now access 8.8.8.8 through Peer B -> Peer A (Netbird route).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant