I am desperately trying to setup a gateway-server that forwards all local traffic to a ppp0 connection but is still reachable via ssh on the local network.
The point-to-point connection establishes fine, IP-forwarding is enabled and with
route add -net 0.0.0.0/0 ppp0 iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
I almost achieve what I want. But once "route" is set, the gateway-server can no longer be reached via ssh.
I am pretty new to "route" and "iptables" and do not fully understand how they work yet but there has to be a super simple solution for my problem.
A very similar question without proper solution: How can I route outgoing traffic through a PPTP VPN connection on a VPS without losing SSH access?
EDIT: A more detailed example below
LOCALHOST (192.168.0.1) --> GATEWAY (192.168.0.2) --> VPN (22.214.171.124)
GATEWAY shall be a local gateway to the internet via VPN. This is quite an easy setup as described above: Enable IP-forward, establish a PPTP connection between GATEWAY<>VPN and set a default route through ppp0 afterwards.
LOCALHOST can now use GATEWAY for internet access with VPN's IP-address but access to GATEWAY within the local network (192.168.0.X) via SSH does not work anymore once the PPTP connection is established.
EDIT2: ifconfig and route output (192.168.0.10 is the 'regular' local gateway)
eth0 Link encap:Ethernet Hardware Adresse 12:34:56:78:90:ab inet Adresse:192.168.0.1 Bcast:192.168.1.255 Maske:255.255.255.0 ppp0 Link encap:Punkt-zu-Punkt-Verbindung inet Adresse:10.10.1.1 P-z-P:126.96.36.199 Maske:255.255.255.255
Ziel Router Genmask Flags Metric Ref Use Iface default * 0.0.0.0 U 0 0 0 ppp0 default 192.168.0.10 0.0.0.0 UG 0 0 0 eth0 188.8.131.52 192.168.0.10 255.255.255.255 UGH 0 0 0 eth0 184.108.40.206 * 255.255.255.255 UH 0 0 0 ppp0 localnet * 255.255.255.0 U 0 0 0 eth0