From what I've read the problem is that when I try connect to my RPI while the openvpn service is active, the return packets are being routed over the VPN and that's the reason I'm not being able to establish the ssh connection.
My current setup is as follows:
Main Router 192.168.3.1
RPI: 192.168.3.2 (with Openvpn client service operating as gateway)
Configured iptables routes
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
iptables -A FORWARD -i tun0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth0 -o tun0 -j ACCEPT
iptables -A FORWARD -i tun0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth0 -o tun0 -j ACCEPT
ip route command output
0.0.0.0/1 via 10.35.0.13 dev tun0
default via 192.168.3.1 dev eth0 metric 202
10.35.0.1 via 10.35.0.13 dev tun0
10.35.0.13 dev tun0 proto kernel scope link src 10.35.0.14
128.0.0.0/1 via 10.35.0.13 dev tun0
169.57.0.200 via 192.168.3.1 dev eth0
192.168.3.0/24 dev eth0 proto kernel scope link src 192.168.3.2 metric 202
default via 192.168.3.1 dev eth0 metric 202
10.35.0.1 via 10.35.0.13 dev tun0
10.35.0.13 dev tun0 proto kernel scope link src 10.35.0.14
128.0.0.0/1 via 10.35.0.13 dev tun0
169.57.0.200 via 192.168.3.1 dev eth0
192.168.3.0/24 dev eth0 proto kernel scope link src 192.168.3.2 metric 202
ip route add x.x.x51.74/32 via 192.168.3.1 dev eth0
Being x.x.x51.74 the ip of my remote laptop location. The problem is that I need to be able to connect to my Rpi no matter where I am and with that route in only allows me to access the RPI from that specific location.
Someone told me I could use a script that run the following routes but still I'm not able to connect
suggested script
ip rule add from <internal IP of SSH server/VPN client> table 10
ip route add default via <internal IP of gateway/router> table 10
ip route add default via <internal IP of gateway/router> table 10
Thanks