How to allow SSH into Terminal after connecting to VPN server using NordVPN servers through OpenVPN?

I’m using Linux CentOS 7 Server and I already installed OpenVPN and NordVPN servers which I use to connect my Linux to.

After establishing the VPN Connection, immediately my SSH access got disconnected.

How to allow SSH access to the server while it’s connected to VPN Server? And how to make it work whenever the server is rebooted?

I used this tutorial on my setup: https://nordvpn.com/tutorials/linux/openvpn/

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

When using the NordVPN Linux client, iptables are used to change traffic instead of modifying the routes. To allow SSH to go through, you need to whitelist the SSH port.

nordvpn whitelist add port 22

Method 2

I were able to find a solution for my issue by:

when you connect to the Server by its public IP address, the return packets get routed over the VPN. You need to force these packets to be routed over the public eth0 interface. These route commands should do the trick:

ip rule add from x.x.x.x table 128
ip route add table 128 to y.y.y.y/y dev eth0
ip route add table 128 default via z.z.z.z

Where x.x.x.x is your Server public IP,
y.y.y.y/y should be the subnet of your Server public IP address,
eth0 should be your Server public Ethernet interface,
and z.z.z.z should be the default gateway.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x