Hey there guys, long time user first time poster and I thought I would start with a fun one.
I have had a wireguard setup for the last few years with a vps and some servers that are connected to it. The vpn has some public ip addresses allocated to it and I’m just using iptables to redirect traffic to these servers on the wireguard network.
Now this is the only thing that I have left that I have not moved over to netbird and thought I would spin up a test and see if I can make this kind of setup work.
What I have done is spun up a clean vps ubuntu instance, spun up a local one and have connected them both to my netbird instance. I’ve setup a group and assigned them to it, allowed all traffic through it and setup the vps as a exit node.
I install nginx and add a iptable port route to this and bam, its working. Which is great! However I’m having a issue with masquerading.
I have my iptables setup to pass on the external ip address using the following with the vps external ip being x.x.x.x my vps netbird ip being y.y.y.y and my server being z.z.z.z
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -d x.x.x.x/32 -j DNAT --to-destination z.z.z.z:80
iptables -t nat -A POSTROUTING -s z.z.z.z -j SNAT --to x.x.x.x
This is how I have my wireguard setup and this passes through any external ip address to the servers behind it. However with netbird im seeing the vpn netbird ip. Heres a log example from nginx.
y.y.y.y - - [06/Aug/2025:02:28:57 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
I’m not sure what to do now, this looks like its still masquerading and checking the ip tables does show that, I’m just not too sure what to do. So i thought I would throw it into the void and see if anyone has an idea, I’ve done as much google-fu as i can with this and did find something kind of simular to this on github but the firewall rules didn’t seem to work.
Also before anyone tells me to just throw a reverse proxy and be done with it. The services that are behind the wireguard setup are not http so I do need the external ip’s to be passed through, this was just done as a easy way to test connectivity and to see if the correct ip address is seen.
Anyway hope someone out there might have an idea. If i figure anything out I’ll make sure to reply to this with it
.