I have an Ubuntu machine at home which I can access over SSH (my router forwards that port). It works fine except when my PC is connected to the VPN, in which case all traffic (including response to incoming connections) goes out the VPN. This is because when the VPN is on and an SSH client tries to connect, my PC sees incoming connection from my SSH client's public IP address and replies to its public IP address via the VPN interface. So the SSH client trying to connect to my PC at IP address (my router's public IP address) receives the response from IP address (my VPN's public IP address) and ignores it.

Is there a way to do either of those

  1. configure my router (Ubiquiti EdgeRouter X) to masquerade and make incoming connections appear to come from its local IP (as is the case with hairpinning when a client on the LAN connects to the PC via its public IP address)
  2. configure openvpn or iptables to send replies to incoming connections via the normal LAN interface rather than the tunnel interface


Browse other questions tagged .