0

Is it possible to connect to Linux VPS via VPN running on another Linux VPS at all? I have 2 Debian VPS boxes. The first one runs openvpn only. The second one is production. I entered the IP address of the one that runs openvpn into the second one iptables' rules, allowing it to connect -A INPUT -s 1.1.1.1/32 -p tcp -m tcp --dport 22 -j ACCEPT. However, it always times out and won't connect. For testing purposes I flushed all the iptable rules but it still won't connect. The box that runs openvpn is working fine. The second production box is also working fine. Now how do I connect my running openvpn box to my production box via SSH? I can also connect from my machine at home to both boxes OK. I thought that all that my production box needed was to allow the IP address through iptables but... it appears to be not the case. Would highly appreciate any pointers / suggestions / help at all. Many thanks in advance.

# Generated by iptables-save v1.8.2 on Mon Jul 19 11:23:12 2021
*nat
:PREROUTING ACCEPT [109935:17664249]
:INPUT ACCEPT [3374:238825]
:OUTPUT ACCEPT [256:14081]
:POSTROUTING ACCEPT [256:14081]
COMMIT
# Completed on Mon Jul 19 11:23:12 2021
# Generated by iptables-save v1.8.2 on Mon Jul 19 11:23:12 2021
*mangle
:OUTPUT ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:MARK - [0:0]
:FORWARD ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
COMMIT
# Completed on Mon Jul 19 11:23:12 2021
# Generated by iptables-save v1.8.2 on Mon Jul 19 11:23:12 2021
*filter
:INPUT ACCEPT [515175:66884905]
:FORWARD ACCEPT [1015130:1311622928]
:OUTPUT ACCEPT [1014840:1315160290]
-A INPUT -s 1.1.1.1/32 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j DROP
COMMIT
# Completed on Mon Jul 19 11:23:12 2021
4
  • How do you ssh to this machine from home if you haven't allowed your home IP address?! Jul 19, 2021 at 18:18
  • I added the complete firewall to my question. It's not much. It won't connect when the firewall (iptables) are totally flushed as mentioned in my question (means no firewall at all).
    – user465521
    Jul 19, 2021 at 18:19
  • In that case the problem is not with the firewall and there's little point looking at it. You need to look at your VPN server's routing table instead. Jul 19, 2021 at 18:20
  • How would I do that and what do I need to look for in my VPN's routing table? VPN is working perfectly well.
    – user465521
    Jul 19, 2021 at 22:59

1 Answer 1

0

Let me answer my own question. Not sure why it works this way but it works. I simply allowed "password logins" and it all started working perfectly well. It connects using ssh keys anyway without any password prompts but.. nonetheless allowing password logins in ssh solved the issue (I had it turned off earlier). Hope it will help someone too.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .