• 1 Post
  • 6 Comments
Joined 1 year ago
cake
Cake day: June 18th, 2023

help-circle

  • Okay, can we go back to those iptables commands?

    iptables -t nat -A PREROUTING -d {VPS_PUBLIC_IP}/32 -p tcp -m tcp --dport {PORT} -j DNAT --to-destination {VPN_CLIENT_ADDRESS}
    iptables -t nat -A POSTROUTING -s {VPN_SUBNET}/24 -o eth0 -j MASQUERADE
    

    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.



  • 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).




  • 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:

    network:
      version: 2
      renderer: networkd
      ethernets:
        eth0:
          dhcp4: true
          routes:
            - to: 0.0.0.0/0
              via: <vps public ip>
    

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