nickshanks

@nickshanks@lemmy.world

This profile is from a federated server and may be incomplete. Browse more on the original instance.

nickshanks,

Thank you so much for the quick and detailed reply, appreciate it!

Done all of the iptables stuff, just trying to change the default gateway on the server at home now:

<pre style="background-color:#ffffff;">
<span style="color:#323232;">network:
</span><span style="color:#323232;">  version: 2
</span><span style="color:#323232;">  renderer: networkd
</span><span style="color:#323232;">  ethernets:
</span><span style="color:#323232;">    eth0:
</span><span style="color:#323232;">      dhcp4: true
</span><span style="color:#323232;">      routes:
</span><span style="color:#323232;">        - to: 0.0.0.0/0
</span><span style="color:#323232;">          via: <vps public ip>
</span>

Does the above netplan yaml look right? When it’s applied, I can’t access the internet or even the VPS public IP.

nickshanks,

Do I need to specify to forward VPN traffic through my router and then traffic to 0.0.0.0/0 through the VPN?

nickshanks,

Everything I use is in Docker too, I’d much rather use Docker than mess around with host files, but to try it out I don’t mind. If you have an image you could share, I’d appreciate it.

Anyway, neither are clients or servers as I just used ZeroTier as a quick setup. On my other infra I use wireguard with the VPS being the server (that setup works well but I only reverse proxy HTTP stuff so X-Forwarded-For works well).

nickshanks,

Thanks, this helps a lot. So in your OpenVPN config, on the client, do you have it to send all traffic back through the VPN?

nickshanks,

Okay, can we go back to those iptables commands?

<pre style="background-color:#ffffff;">
<span style="color:#323232;">iptables -t nat -A PREROUTING -d {VPS_PUBLIC_IP}/32 -p tcp -m tcp --dport {PORT} -j DNAT --to-destination {VPN_CLIENT_ADDRESS}
</span><span style="color:#323232;">iptables -t nat -A POSTROUTING -s {VPN_SUBNET}/24 -o eth0 -j MASQUERADE
</span>

Just to confirm, is the -o eth0 in the second command essentially the interface where all the traffic is coming in? I’ve setup a quick Wireguard VPN with Docker, setup the client so that it routes ALL traffic through the VPN. Doing something like curl ifconfig.me now shows the public IP of the VPS… this is good. But it seems like the iptables command aren’t working for me.

nickshanks,

Would this work for my use case? I just want a service to be able to see the real source IPs but still going through a proxy

nickshanks,

I realised I forgot to update this. Thank you to everyone that contributed, I appreciate it. This was a weird use case and barely anyone online has documented it, only a handful of places. Nevertheless, I figured it out.

So basically, you run HAProxy with the send-proxy-v2 protocol. Let’s say I’m forwarding SSH from VPS to home, I’d have the VPS running HAProxy listening on port 22. Then I’d have it forward to home on port 220. Then, on the home server, you run this amazing piece of software called go-mmproxy. Configure that to listen on port 220 and forward to localhost 22. And there you have it.

HAProxy passes the real source IP to go-mmproxy with the proxy protocol, go-mmproxy takes the proxy header and strips it from the request, spoofs the source IP address from localhost to the real source IP contained in the proxy header then makes the request to localhost. And then you also have to configure traffic to go back through localhost so go-mmproxy can pick it up and add the proxy header back to the request, to be sent back to the source.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • provamag3
  • thenastyranch
  • magazineikmin
  • cisconetworking
  • ethstaker
  • osvaldo12
  • InstantRegret
  • Youngstown
  • Durango
  • slotface
  • rosin
  • GTA5RPClips
  • kavyap
  • mdbf
  • JUstTest
  • DreamBathrooms
  • everett
  • tester
  • anitta
  • tacticalgear
  • ngwrru68w68
  • cubers
  • modclub
  • khanakhh
  • megavids
  • Leos
  • normalnudes
  • lostlight
  • All magazines