I have subscribed a Dedicated IP of NordVPN and followed the official instructions to install necessary packages in my AWS EC2 Ubuntu instance. I normally access the instance via AWS admin console. Yet I struggled with two issues:
- The terminal will always freeze when I try to execute:
sudo nordvpn connect xxx
wherexxx
is my dedicated IP's server - While I don't know why the above command fails, I manage to manually connect via
openvpn
command with some IP rules (Ref: https://serverfault.com/questions/659955/allowing-ssh-on-a-server-with-an-active-openvpn-client/660106#660106). However if I do not kill / disconnect the vpn connection, I cannot SSH access my EC2 instance anymore
sudo ip rule add from $(ip route get 1 | grep -Po '(?<=src )(\S+)') table 128sudo ip route add table 128 to $(ip route get 1 | grep -Po '(?<=src )(\S+)')/32 dev $(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')sudo ip route add table 128 default via $(ip -4 route ls | grep default | grep -Po '(?<=via )(\S+)')sudo route add -host [my EC2's elastic IP] gw [my EC2's gateway]sudo openvpn --config /etc/openvpn/ovpn_udp/xxx.nordvpn.com.udp.ovpn --daemon --auth-user-pass pass.txt --auth-nocache
So my question is:
Why the official command of NordVPN doesn't work as expected, and is there any way to make my EC2 instance SSH accessible even if the VPN is connected?