I want to route network traffic that comes from one end of an ssh tunnel (constructed by ssh dynamic port-forwarding) into one end of a VPN tunnel.
Given four Linux devices A, B, C and D, for example, I want to make a network traffic route
A --ssh_tunnel--> B ------> C
A --ssh_tunnel--> B --GRE_tunnel--> D ------> C
All the IP addresses of these devices are static except C which is dynamic. To make the above topology, I properly configured device D and confirmed that the GRE tunnel is successfully established.
However I could not find how to configure device B in order to route traffic that comes from A through the ssh tunnel to the GRE tunnel which is established between B and D. Since the IP address of C is dynamic, destination-based routing which can be configured on B (using
route) is not possible. Actually I tried to configure device B with
iptables command lines to apply source based routing, but I could not reach a solution.