Posted on

opening 2 simultaneous vpn connections with OpenVpn

With OpenVpn you can open 2 or more vpn channels simultaneously. Naturally the 2 networks in connections will have to be different.

When you launch a connection with OpenVpn, it engages the Tab Adapter network card that was installed during the installation of OpenVpn. If you try to open a new connection with OpenVpn you will be notified that the TabAdpater tab is already in use.

To solve the problem the trick is to install a new TabAdapter. When you launch the second connection OpenVpn will use this second card.

Install a TabAdapter
Unfortunately we only have pictures in Italian, I hope it will still be useful.

Go to Device Manager and click Action – Add Hardware

This form appears:

Click on Next

Select “Install the selected hardware…” and click next

Select network adapters and click Next

Select TAP-Windows Provider V9 and click Next

Click on Next and then on Finish. This will give you a new TAP Adapter

Posted on

Speed of a remote backup

To build a backup environment it is recommended to follow the 3-2-1 rule.

  • Make 3 backups
  • Make 2 backups on different media
  • Make 1 backup in another location than the source data

To carry out the third tip, we very often think of the Cloud; it’s a great solution but the costs are still quite high if we need to move TB. If, on the other hand, we have to save some GB, the solution is attractive.

For companies that need to move TB of data, a solution can be backup to a remote location, for example connected with a vpn. The costs of saving the data will therefore be absorbed by the purchase costs of a fairly large NAS unit.

Let us try to detail such a solution.

Backup speed in vpn

The speed of the backup will be determined by the slowest internet connection speed between the 2 locations. Let’s suppose that the 2 offices are able to communicate at the speed of 300 Mb / s.

300 Mb / s = 300,000,000 b / s

300,000,000 b / s / 8 = 37,500,000 b / s = 37.5 MB / s

To move 1GB of data over a 300 Mb / s network, it will take 1,000 / 37.5 = 26.7 seconds

To move 1GB of data over a 100 Mb / s network, it will take 1,000 / 12.5 = 80 seconds

Backup software all have the ability to perform incremental backups but the first backup that is performed will inevitably be very long. So it needs to be planned carefully.

If we want to move a 20GB virtual machine across a 300 Mb / s network, it will take about 27 minutes. It will take us 2 hours and 15 minutes for a 1TB virtual machine. The incremental backups of the various software on the market, in “normal” conditions of server activity, allow subsequent backups to arrive at times equal to 20% of the first backup.

Choice of Backup NAS

The source site data is stored on Nas at the destination site. It is clear that choosing a NAS equipped with a 10Gb / S ethernet card does not improve our remote backup since the transfer speed of the vpn is less than 1Gb / s.

Could the NAS disks further decrease the copy speed? To answer this, let’s take a look at a table that tries to give a value to the write speeds of the various disk systems. We took the data from the wikipedia site and then processed it.

Drive

(Type / RPM )

MB/s

(64KB block, random)

MB/s

(512KB block, random)

MB/s random

average

MB/s

(large block, sequential)

MB/s sequenzial

average

FC / 15 K 9.7 – 10.8 49.7 – 63.1 33,3 73.5 – 127.5 100,5
SAS / 15 K 11.2 – 12.3 58.9 – 68.9 37,8 91.5 – 126.3 108,9
FC / 10 K 8.3 – 9.2 40.9 – 53.1 27,9 58.1 – 107.2 82,65
SAS / 10 K 8.3 – 9.2 40.9 – 53.1 27,9 58.1 – 107.2 82,65
SAS/SATA / 7200 4.4 – 4.9 24.3 – 32.1 16,4 43.4 – 97.8 70,6
SATA / 5400 3.5 22.6 13,05 47,1 (estimate)
SSD 520 520

Backup software normally writes disks sequentially, so numbers in hand, even a sata 5400 hard drive could be useful in our scenario. Buying hard drives above 7200 rpm, on the other hand, would not lead to an improvement.

Posted on

Configure a Point-to-Site VPN connection via Openvpn on Azure

Create a virtual network

  1. Sign in to the Azure portal.
  2. In Search resources, service, and docs , type virtual network.
  3. On the Virtual Network page, select Create.
  4. On the IP Addresses tab, configure the values

Subnet: If you use the default address space, a default subnet is created automatically.

  • Subnet name: In this example, we named the subnet “FrontEnd”.
  • Subnet address range: The address range for this subnet.

On the Security tab, at this time, leave the default values:

  • DDos protection: Basic
  • Firewall: Disabled

So we will have this configuration (as example) :

  • Address space: 10.1.0.0/16
    Subnet name: FrontEnd
  • Subnet address range: 10.1.0.0/24

Create a virtual network gateway

  1. In the Search the Marketplace field, type ‘Virtual Network Gateway’

SKU: Select the gateway SKU from the dropdown. For Openvpn you need to select VpnGw1 because

Gateway subnet address range: This field only appears if your VNet doesn’t have a gateway subnet. If possible, make the range /27 or larger (/26,/25 etc.)

In this example :

GatewaySubnet: 10.1.1.0/27

Certificates

Certificates are used by Azure to authenticate clients connecting to a VNet over a Point-to-Site VPN connection. You have two options : use a root certificate that was generated with an enterprise solution (recommended), or generate a self-signed certificate.

Generate and export certificates for Point-to-Site using PowerShell

Two steps : generate root certificate; generate client certificate.

root certificate

From a computer running Windows 10 or Windows Server 2016, open a Windows PowerShell console in Admin mode.

Use the following example to create the self-signed root certificate. The following example creates a self-signed root certificate named ‘TestVPNRootCert’ that is automatically installed in ‘Certificates-Current User\Personal\Certificates’.

$cert = New-SelfSignedCertificate -Type Custom -KeySpec Signature -Subject "CN=TestVPNRootCert" -KeyExportPolicy Exportable -HashAlgorithm sha256 -KeyLength 2048 -CertStoreLocation "Cert:\CurrentUser\My" -KeyUsageProperty Sign -KeyUsage CertSign

You can view the certificate by opening certmgr.msc, or Manage User Certificates.

client certificate

Each client computer that connects to a VNet using Point-to-Site must have a client certificate installed. You generate a client certificate from the self-signed root certificate.

From a computer running Windows 10 or Windows Server 2016, open a Windows PowerShell console in Admin mode. Identify the self-signed root certificate that is installed on the computer. This cmdlet returns a list of certificates that are installed on your computer.

Get-ChildItem -Path "Cert:\CurrentUser\My"

As output you will see a string and a name for every certificate installed on your machine.

For example :

AED812AD883826FF76B4D1D5A77B3C08EFA79F3F CN=MyOldVPNRootCert

7181AA8C1B4D34EEDB2F3D3BEC5839F3FE52D655 CN=TestVPNRootCert

Declare a variable for the root certificate using the string from the previous step:

$cert = Get-ChildItem -Path “Cert:\CurrentUser\My\7181AA8C1B4D34EEDB2F3D3BEC5839F3FE52D655”

Modify and run the example to generate a client certificate. The result of the following example is a client certificate named ‘TestVPNClientCert’

New-SelfSignedCertificate -Type Custom -DnsName TestVPNClientCert -KeySpec Signature  -Subject "CN=TestVPNClientCert" -KeyExportPolicy Exportable  -HashAlgorithm sha256 -KeyLength 2048  -CertStoreLocation "Cert:\CurrentUser\My"  -Signer $cert -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.2")

The client certificate that you generate is automatically installed in ‘Certificates – Current User\Personal\Certificates’ on your computer.

Export the root certificate public key (.cer)

To obtain a .cer file from the certificate, open Manage user certificates. Locate the self-signed root certificate, typically in ‘Certificates – Current User\Personal\Certificates’, and right-click. Click All Tasks, and then click Export. This opens the Certificate Export Wizard.

Select No, do not export the private key, and then click Next

On the Export File Format page, select Base-64 encoded X.509 (.CER)., and then click Next.

For File to ExportBrowse to the location to which you want to export the certificate. For File name, name the certificate file. Then, click Next.

Click Finish to export the certificate. You’ll find a file .cer in location selected.

Export the client certificate

To export a client certificate, open Manage user certificates. The client certificates that you generated are, by default, located in ‘Certificates – Current User\Personal\Certificates’. Right-click the client certificate that you want to export, click all tasks, and then click Export to open the Certificate Export Wizard.

Select Yes, export the private key, and then click Next. IMPORTANT!!!!

On the Export File Format page, leave the defaults selected. Make sure that Include all certificates in the certification path if possible is selected

On the Security page, you must protect the private key, using a password.

On the File to ExportBrowse to the location to which you want to export the certificate. For File name, name the certificate file. Then, click Next.Click Finish to export the certificate.

Add the client address pool

The client address pool is a range of private IP addresses that you specify. The clients that connect over a Point-to-Site VPN dynamically receive an IP address from this range. Use a private IP address range that does not overlap with the on-premises location that you connect from, or the VNet that you want to connect to.

Open virtual network gateway configuration page, navigate to the Settings section of the virtual network gateway page. In the Settings section, select Point-to-site configuration. Select Configure now to open the configuration page.

In the Address pool box, add the private IP address range that you want to use. VPN clients dynamically receive an IP address from the range that you specify.

For example : 172.16.0.0/24

Tunnel Type : OpenVpn

Authentication Type : Azure certificate

In root certificate section you have to put the root certificate name (in this example TestVPNRootCert).

Open the root certificate file (.cer) with a text editor, such as Notepad. Copy the text as in image and past it in “Public certificate data”

Save Point to Site Configuration.

Download vpn Client clicking on “Download vpn Client” 🙂

Install Openssl

https://slproweb.com/products/Win32OpenSSL.html

Extract the private key and the base64 thumbprint from the .pfx client certificate.

Using OpenSSL on your machine is one way. The profileinfo.txt file contains the private key and the thumbprint for the CA and the Client certificate

openssl pkcs12 -in “C:\myfolder\clientcert_vpn_test.pfx” -nodes -out “C:\myfolder\profileinfo.txt”

Configure openvpn client

Unzip the profile downloaded from virtual network point to site configuration. Next, open the vpnconfig.ovpn configuration file from the OpenVPN folder using Notepad. Open profileinfo.txt in Notepad and copy and paste in vpnconfig.ovpn the sections :

# P2S client certificate
# please fill this field with a PEM formatted cert
<cert>
$CLIENTCERTIFICATE
</cert>
# P2S client root certificate private key
# please fill this field with a PEM formatted key
<key>
$PRIVATEKEY
</key>

IMPORTANT :certificate and kay need to be insert in  openvpncon with  —- begin — and —-end —–