DEV Community

Cover image for Open Vpn
Nishita Mohanty
Nishita Mohanty

Posted on • Edited on

Open Vpn

How to connect a private server(i.e. the server without a public IP address)?
Well there is a solution for the above concern, which leads us to learn a new concept named OpenVpn.

So, what is OpenVpn?
Well OpenVpn is a type of computer network that provides users with remote access to resources on the internet.

So how can we use it to connect a server?
Well the solution to the above query is given below.

STEP 1. Launch an instance without public IP.
Image description

Image description

So, to connect the server we have to setup a VPN connectivity.
**
STEP 2. Go to **launch instances
then in the search bar search for openvpn -> click on 44 results.
Image description

Then select the 1st openvpn.
Image description
STEP 3. Then launch another instance with public IP enabled -> create new key pair -> launch instances.

Image description
Image description
Image description

Now, we can see that both the instances which we have launched have same VPC ID.
Image description
Image description

STEP 3. Now we need to connect the second server i.e. with public IP to Xshell -> Then type yes and then enter multiple times.
Image description
Image description
Image description
Then openvpn will initialize
Image description
Then after some time again paste the same command (SSH client) and of root write openvpnas -> then again connect with the key pair.

Now already a openvpn (user) is created so now we have to change password.
So, type sudo passwd -> enter
Give password

Image description

Then scroll up and copy link of Admin and Client and paste it in notepad.
Image description
Now close Xshell.

Now, copy the admin's url and paste it in browser -> login to openvpn -> Agree
Image description

Image description

Now again go to instances.
Then connect the instance (without public IP) through Xshell
Image description

But we will notice that it wont get connected.
Image description

STEP 4. Now open OpenVpn -> connect -> next (multiple times) -> agree ok -> Give url i.e. copy the IP of client link and paste -> next -> accept -> username : openvpn ->Password: give the password which u have set earlier in Xshell -> Accept -> Connect -> Password -> OK

Image description
Image description
Image description
Image description
Image description
Image description
Image description
Image description
Image description

Then go to Xshell and try to connect the instance (without public key) again. Now, u will be able to connect/access the instance.
Image description

So, this is the way by which we can connect servers without public IP address through openvpn.

Top comments (0)