Site to Site setup in Azure
Tags: azure, cloudnative, beginners, tutorial
Published: 2022-08-01 04:58:42

Site to site is an amazing concept introduced in every cloud platform. **Site to site , as the name suggests is a technique in which one site (on-cloud) is connected to a second site (on-premises).**
There are many such situations when we will require to setup such a situation where our on-premises servers can communicate with cloud virtual machines or servers safely and securely.
The solution to such a setup is creating a Site to Site connection.

Below, I have shown all the steps you need to configure at the Azure side to set a Site-to-Site connection. After following the steps you will get a configuration file which will be handed to the network manager of the on-premises server and complete setup will be done.

**Components required for this setup are:**
1. Virtual network with a default defined subnet and a Gateway subnet.
2. Virtual network gateway
3. Local network gateway

**Step- 1: Create a Virtual network with a default subnet**
Specify the Virtual network IP address and create the Virtual network with a default subnet. I have created the Virtual network with IP as 10.0.0.0/16 and subnet with 10.0.1.0/24 . The final details will be shown as follows:

![Virtual network](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/09cpnuym4iqt1xzu7jfc.PNG)

**Step- 2: Add the Gateway Subnet to this Network**
To add Gateway Subnet, Go to Subnets >> Click on the "+Gateway subnet" >> Now specify the address for it and click on Add.

![Gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/84ofo2p8vqk91jrgzxfy.PNG)

**Step- 3: Create a Local Network Gateway**
Here, all the specifications of your on-premises server is added.
Since, this is just for tutorial purpose I don't have a on-premises server, I am using some random IP address. In real situation you have to specify the **Static IP address** of the on-premises server or the **Fully Qualified Domain Name**
The final configuration should look like this:

![Local gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9bdrpr4jcwc9y84si6wf.PNG)

**Step- 4: Create Virtual Network Gateway**
Search for Virtual Network Gateway and select the Virtual network created. Select other options as required or leave to Default.
Final configurations for reference:

![VPN gateway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5898v91dqie0rvvcm3wi.PNG)

![VPN gateway 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/veqfd39nuglojn85fqu0.PNG)

**Step- 5: Create a Connection**
Inside the Virtual Network gateway resource , Select Connections. Then Select Add connection.

![Connection](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hdnj5ljew51o95m2m9sc.PNG)

Next specify the connection details and choose Site to Site in the connection type. Next you need to specify the Shared Access Key of your on-premises server. After successfully completing the steps you will find a configuration file. Download this and provide to the network engineers on the other side

![Connection](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o6rn565gyh7rnqrwms80.PNG)

That was all the steps for setting a Site to Site connection.