How to Make a VPN in Visual Basic

OpenVPN is a VPN software that was initially designed for the UNIX operating system. It is very secure, easy to use, and very portable. Later on, the OpenVPN team has also provided a Windows version which is open sourced and free software licensed under the GNU General Public License (GPL). So you can use OpenVPN on Windows too.

In this tutorial, we will show you how to make a VPN in Visual Basic so that you can use a secure connection to access the internet wherever you go on your computer.

Setting Up OpenVPN On Your System

As a first step, you will need to download and install the OpenVPN client software on your computer. There is a portable version that you can carry with you (highly recommended), and a version for Windows that you can install on your system. We will assume here that you have downloaded the portable version and installed it on a USB drive that you carry with you. If you use a version for Windows, it is highly recommended to download it to a separate partition so that you can easily reinstall it if necessary (e.g., in case your computer gets damaged or infected with a virus).

Configuring Your VPN On The Go

Once you have installed OpenVPN on your system, you need to configure it so that you can use it on the go. To do that, you need to enter the following details on your system:

  • Your full name
  • Your email address
  • Your phone number
  • The password for your account
  • The port to which you want to connect (PPTP only supports a few ports)
  • The country you are in
  • The website you want to use for the VPN (if any)

These details will then be saved and stored on the system so that you don’t have to reenter them whenever you use the VPN.

Generating A Certificate For Your VPN

One of the first things you will need to do after configuring your VPN is to generate a certificate for it. To do that, you will need the Strong Cryptography Library, which you can download and install on your system. Once that is installed, you can use the following command to generate a certificate for your VPN:

openssl req -new -x509 -days 365 -key private/VPN_Key -out C:\temp\sample-cert.pem

This will then prompt you to enter the following information:

  • Your full name: the user name you will use to access the certificate (e.g., Admin)
  • Your email address: the email address you will use to notify you about the certificate (e.g., admin@example.com)
  • Your phone number: the phone number you will use to identify yourself with the cert (e.g., 312-987-6543)
  • The country: the country you will use to identify yourself with the cert (e.g., United States)
  • The website: the website you want to use for the certificate (e.g., example.com)
  • The organization: the organization you represent (e.g., Company Name)
  • The organization name: the organization name you represent (e.g., Company Name)
  • The city: the city you represent (e.g., London)
  • The subject: the name of the person who will own the certificate (e.g., Admin)
  • The password: the password you will use to encrypt the certificate (e.g., 12345)
  • A new private key: if you decide later on that you don’t want to use the same key to decrypt the certificate as you used to encrypt it, you can choose this option and generate a new private key.

Activating Your VPN Once Generated

After you have generated the certificate, you will need to activate your VPN. To do that, you will enter the following details in the OpenVPN client software:

  • Your full name: the user name you will use to access the certificate (e.g., Admin)
  • Your email address: the email address you will use to notify you about the certificate (e.g., admin@example.com)
  • Your phone number: the phone number you will use to identify yourself with the cert (e.g., 312-987-6543)
  • Country you are in: the country you will use to identify yourself with the cert (e.g., United States)
  • Website: the website you want to use for the certificate (e.g., example.com)
  • Organization name: the organization you represent (e.g., Company Name)
  • Organization: the organization you represent (e.g., Company Name)
  • City: the city you represent (e.g., London)
  • Subject: the name of the person who will own the certificate (e.g., Admin)
  • Password: the password you will use to encrypt the certificate (e.g., 12345)
  • Save this configuration file: if you decide later on that you want to change the settings of your VPN, you can choose this option and save the file to a new location.

Enabling IP Forwarding

Once you have configured your VPN, you will need to enable IP Forwarding on your network adapter so that your computer can access the internet through the VPN. To do that, you will enter the following in the Command Prompt:

netsh interface ipv4 add forwarding Enabled 

Where Enabled is the name of your network adapter (e.g., Local Area Connection 2)

Testing Your VPN Connection

Now that you have configured your VPN and have your network adapter set to use the VPN for Incoming connections, you can test the connection to see if it is working. To do that, you will enter the following in the Command Prompt:

ping www.google.com 

Where www.google.com is the address of one of the websites that you want to access through the VPN.

If you are prompted for a password, you will need to enter the password you used to encrypt the certificate. Once you do that, you will see a message like this:

Pinging Google.com [199.16.178.133](7400 bytes)(request timed out)(Connection timed out)

Which means that the connection is working. If you get a different result, it means that there is a problem with the configuration of your VPN or your network adapter.

Securely Configuring Your Wi-Fi Connection

Since you are on the move, staying connected to a public Wi-Fi hotspot is inevitable. To protect your personal data while using public Wi-Fi, you will need to configure your Wi-Fi connection so that it uses a VPN to secure your connection. To do that, you will need to follow these simple steps:

  • Open the Settings app on your iPhone.
  • Navigate to the Personal section.
  • Click on the Wi-Fi icon.
  • Tap on the Connected Wi-Fi networks.
  • Tap on the network you want to connect to (e.g., Hotel XYZ).
  • Enter your email address and password if necessary.
  • Tap on the OK button to confirm your Wi-Fi connection settings.

You can then use your Wi-Fi connection as usual, browsing the web and sending emails securely through the VPN connection.