Brief descriptionI've got two systems, a VPS which is connected directly to the internet, and a system in my basement behind my router (NAT). I'd like to take the VPS and forward all requests on one of it's IP addresses, on any port, to the system in my basement. I've connected the two using OpenVPN, and I successfully accomplished what I set out to do- I can use the following procedure to forward all requests on the IP to the machine in my basement.Connect machines via OpenVPNRun the following command on the internet facing VPS iptables -t nat -A PREROUTING -d public.facing.vps.ip -j DNAT --to-destination basement.computer.vpn.ipRun the following commands on the basement machineecho '100 VPN' >> /etc/iproute2/rt_tables (only once)ip rule add from vpn.subnet/24 table VPNip route add default via vpn.gateway.ip table VPNThis works consistently, but I took the final set of commands from this article which talks strictly about it in the context of GRE tunnels, and I've had a very difficult time trying to understand the meaning in the last step.My questionIs it possible to have OpenVPN server, or configure the client, to automatically do the (policy based?) routing to return packets through the tunnel? I'm unsure as to the exact meaning of the bottom set of commands, which is why I've found it tricky to 'translate' them from their current expression into an openvpn 'route'It seems that they are something called 'policy based routing'- when a packet comes from the vpn subnet, it will route it back through the vpn gateway (by changing it's routing table to 'VPN')I'd like to have this done automatically by OpenVPN because I would presume OpenVPN can perform a similar act on windows, something I've yet to figure it. It'd also be nice to have this done automatically so that I could then automate the iptables rule for forwarding traffic on a public IP to a VPN client.FilesConfiguration Files
Trying to reverse proxy requests to a VPS IP to an internal server over OpenVPN, how to do the routing tables automatically?
networking;routing;openvpn;tunneling