Score:0

Connect to Linux VPS via VPN running on Another Linux VPS

kr flag

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
Michael Hampton avatar
cz flag
How do you ssh to this machine from home if you haven't allowed your home IP address?!
Dennis avatar
kr flag
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).
Michael Hampton avatar
cz flag
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.
Dennis avatar
kr flag
How would I do that and what do I need to look for in my VPN's routing table? VPN is working perfectly well.
Score:0
kr flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.