Creating Site To Site VPN


The article given below explains how to create a site to site VPN connection. We can use these connected site to site VPNs to create the connections between two different Virtual Machines. Before we get into the process, I need you to create two different virtual networks on Azure portal. If you know how to create a new virtual network, then please do it. If you are not familiar with it, click on the link.

Once you finish creating two different virtual networks, proceed with this article.

Site to Site VPN

A site-to-site VPN allows offices in multiple fixed locations to establish secure connections with each other over a public network, such as the internet. Site-to-site VPN extends the company's network, making computer resources from one location available to the employees at the other locations. An example of a company that needs a site-to-site VPN is a growing corporation with dozens of branch offices around the world. Surf about these site to site VPNs to learn a lot about them.

Steps for creating a Site to Site VPN
  1. Deciding IP addresses.
  2. Creating virtual networks.
  3. Creating local network gateway.
  4. Creating virtual network gateway.
  5. Creating connection.

Deciding VPN and virtual networks

Be certain about the number of IP addresses you like to have in your site to site connection. The number of IP addresses range you have is the number of instances you can make. And the next step is to create two different virtual networks which you have already created. Once you finish creating two different VNets, click on the "All Resources" option in the left pane. This will display all the resources which you have created. Or go to the VNets option. You will be shown the new virtual networks you have created.


Creating local network gateway

The next step is to create a new network gateway.

To do this, go to New >> Networking >> Virtual network gateway.
Once you click on it, you will be see a new window which will ask for your local gateway network name, IP addresses range, and the location along with the subscription.
Here, you need to specify the address range. Do all these and create a new local gateway network.
Repeat the same once again and create one more local gateway network. The reason for creating two different networks again and again is because we are going to connect the two together.


Creating Virtual Network Gateway

After finishing two new local networking gateways, now you have to create two different virtual network gateways again, for your VNETS.

For that, go to New >> Networking >> Virtual network gateway.
This will now show you a window in which you will be asked the name for the gateway, gateway type, VPN type.
Below that, you will be asked to choose the virtual network. Click on it and choose on virtual network from the two VNET which you have previously created.
Once you finish this, choose the public IP address you like to assign to your VNET and then click on the "Create" button.
In the same way, create one more VNET and choose another VNET for this one. Once you click on the "Create" button, it will take up to forty five minutes to create your virtual gateway.


Creating connection

The final step is to create the connection between the two different VPN sites which we have created.

For this, again, go to New >> Networking >> Connection. Once you click on this, you will be shown a configuration page.
Click on the basic configuration settings and select the Vnet to Vnet option. Enter the required details and then click on the "OK" button.
The next one is to choose the virtual network gateway. Click on it and choose any one of the VNET’s. Again for the second virtual network gateway, click on the another VNET. Now, some name for your VNET gets generated.
Finally, create some sort of shared key for your device with the combination of some numbers and characters. Now, click on the "OK" button.
Now in the summary, you can see the details of the connections which you have created. Click on "OK" to finish the connection process.



Thus, we have successfully created a site to site VPN connection. Now, you can create separate virtual machines in two different VNETs and share the data in between them. Hope, you have learned a new trick from the following article.

I will try to do more in the coming articles. Thanks for learning. Feel free to ask any queries.