I have a Linux Mint 18.1 desktop on my home LAN. I run PIA VPN on this computer, and also run ssh server listening on port 22. I am able to ssh into this computer from other computers on the LAN using the internal IP address.
I wanted to also ssh into this computer from the internet, so I successfully setup port forwarding on my router. But, I initially was unable to ssh from the internet while PIA VPN was connected. I fixed this by creating source-based IP routing rules as described in the top answer to this post: Reply on same interface as incoming?.
Here are the changes I made:
echo 200 isp2 >> /etc/iproute2/rt_tables
ip rule add from 192.168.1.100 table isp2
ip route add default via 192.168.1.1 dev enp0s25 table isp2
192.168.1.100 is the computer's internal IP address
enp0s25 is my network adapter.
With those changes, I am now able to ssh from the internet to the computer, but ssh from a computer on the LAN no longer works (using either the internal IP address or the WAN address). When I remove those changes, ssh from a LAN computer is restored but I lose access from the internet.
So its clear to me I need to make additional IP routing rules to make access from both LAN and internet/WAN possible simultaneously. Can someone point me in the right direction?
thanks!