The following didn’t work for me but maybe it will help you, I hired the VPN and the dedicated IP through NordVPN.

I have a PC with Ubuntu Server, this PC and that one are on a LAN network, under the same router, with SSH I can connect to its private IP, I want to connect to that host with Ubuntu Server remotely, from the Internet through SSH.

I need it to be accessible from the Internet and for its IP not to change.

That’s what a dedicated IP is for, but a VPN doesn’t make much sense since it would be a network with a single PC.

You need to hire a VPN + dedicated IP service

  • A dedicated IP is a unique and exclusive IP address assigned to a specific device or server on a network.
  • A VPN (Virtual Private Network) is similar to a computer network with a router, but instead of being physically connected, computers and devices connect over the Internet using a virtual router.
  • Think of a VPN as a “private network over the Internet”
  • Each device on a local area network (LAN) has a private IP address, which is unique within that network. These private IP addresses are not accessible from the Internet.
  • Dedicated IP: A unique public IP address assigned to a device or server.

OpenVPN and NordVPN:

  • OpenVPN: It is a VPN protocol that can be used with different VPN providers.
  • NordVPN: is a VPN provider that offers secure and encrypted VPN services using different protocols, including OpenVPN.
  • In addition to OPEVPN, there are other protocols:
    • IKEv2/IPSec: A fast and secure VPN protocol commonly used on mobile devices.
    • WireGuard: A modern, fast VPN protocol that focuses on security and simplicity.
  • You can use NordVPN without using OpenVPN, and choose from other secure and fast connection protocols.

NordVPN uses OpenVPN as one of the connection protocols available in its service.

OpenVPN can be used independently without the need for NordVPN. OpenVPN is a software that can be downloaded and manually configured to connect to any VPN server that supports the OpenVPN protocol.

NordVPN provides easy, automatic setup for its users.

NordVPN is a commercial VPN service that uses OpenVPN technology (among others) to provide a secure and encrypted connection to the Internet.

OpenVPN is open-source software that allows you to create secure, encrypted virtual private networks (VPNs) to protect your online privacy and security.

It is compatible with multiple platforms and is a popular tool for protecting online privacy and security.

NordVPN uses OpenVPN technology as one of the available connection protocols. OpenVPN is a popular and secure VPN protocol that provides a stable, encrypted connection.
NordVPN offers OpenVPN as one of its connection protocol options, along with other protocols such as IKEv2/IPSec and WireGuard. By using OpenVPN, NordVPN can provide a secure and encrypted connection to its VPN servers.

I hired NordVPN services:

https://nordvpn.com/es/offer/?vpn=brand&nc=Search_-Argentina-Brand-Exact+Broad-En-DMT-_USD&ns=google&nm=cpc&nt=nordvpn&na=154128106046&gad_source=1&gad_campaignid=20758268364&gbraid=0AAAAADwsNkRTJBXi0jzCimCUwERb9vFla&gclid=Cj0KCQjwxdXBBhDEARIsAAUkP6iHcg_I3A_COZLQHm7jOVphaur7dFccLEiTbvEFFfS8mah9jgDhG30aAtcOEALw_wcB

You must access the remote host, if it is a device on LAN:

ssh user@private_ip

On that host, you must access 2 folders behind the user’s home

~/.ssh/authorized_key

The correct location for the .ssh directory would be /home/<username>/.ssh or ~/.ssh, depending on how you are accessing the system.

  • The ~/.ssh/authorized_keys file contains the public keys of users who are authorized to access the system from other hosts.
  • The ~/.ssh/authorized_keys file is also used to authenticate the connection.

you must copy the public key to the remote server:

cat ~/.ssh/id_ed25519.pub

There is the public ssh-key

There you must create or access .ssh which is invisible

mkdir -p ~/.ssh

Add the public key manually to the authorized_keys file:

~/.ssh/authorized_keys

all together:

cat ~/.ssh/id_ed25519.pub | ssh <username>@<dedicated_ip> "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

In /etc/openvpn there are 2 important files

  • nordvpn.conf
  • auth.txt

nordvpn.conf or nordvpn.tcp.ovpn or nordvpn.udp.ovpn: Contains the authentication certificate, previously it was a separate ca.crt file

The first one handles the connection between the host and NordVPN.

The second one has NordVPN credentials.

You can obtain the credentials here:

auth.txt format:

your_username
your_password

Replace your_username and your_password with your actual NordVPN credentials.

the content of ‘nordvpn.conf’ It is generated automatically by NordVPN, you just have to choose which server to connect to:

then you must run the following command to run nordvpn and change the public IP:

connection between NordVPN and the host:

sudo openvpn --config /etc/openvpn/nordvpn.conf --auth-user-pass /etc/openvpn/auth.txt

NordVPN Connect is an easier and more convenient way to connect to NordVPN, while OpenVPN provides more control and flexibility over VPN connection settings.

Both commands connect to NordVPN using a secure VPN connection. The difference lies in the way the connection is established and the settings used.

  • NordVPN Connect: Uses NordVPN’s default settings and provides an easy-to-use user interface.
  • OpenVPN with NordVPN Configuration: Uses manual configuration file setup and authentication, providing more control and flexibility over your VPN connection.

Both commands can accomplish the same goal of connecting to NordVPN and protecting your internet traffic, but the choice between them will depend on your personal needs and preferences.

Check if the public IP changed to the dedicated IP:

curl ipinfo.io

ssh uses port 22

you must configure on the router:

  • port triggering
  • port forwarding

To redirect traffic from the external port, that is, router port number 22, and send it to port 22 of the host’s private IP on the local network.

You also activate or enable traffic on external port 22.

You must use the terminal command ‘nordvpn’ if you don’t have it, install it.

alternative to openvpn command

Once NordVPN is connected to the host, you need to activate the NordVPN service on the host.

You must also log in to NordVPN and connect.

nordvpn login --token  <token id>

then you must create a new access token

After logging in with the token, you must turn on the service:

nordvpn connect

You can see the NordVPN settings:

nordvpn settings

view nordvpn status:

nordvpn status

disable NordVPN firewall:

nordvpn set firewall off

If you need to give permissions:

sudo snap connect nordvpn:hardware-observe
sudo snap connect nordvpn:network-control
sudo snap connect nordvpn:network-observe
sudo snap connect nordvpn:firewall-control
sudo snap connect nordvpn:login-session-observe
sudo snap connect nordvpn:system-observe