Site-To-Site VPN connection in the Azure portal
Published: 2022-08-01 16:32:00

**Site-to-site VPN is a type of VPN connection that is created between two separate network locations. It provides the ability to connect geographically separate locations or networks, usually over the public internet connection or a WAN connection.**


## Step 1 - Verify your Virtual Networks
**In the Azure Portal, click the “Virtual Networks” and create**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l4qls8mmtl1n4dj3tzu2.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p6ask3e1za3xz8okh1zr.png)

## Step 2 - Creating a Gateway Subnet
**Now, we have to create a Gateway subnet. So, select “Subnets” and then click “+ Gateway Subnet”.**
**Now, we need to enter the address range (CIDR block) and click “Ok”. The Gateway Subnet is an internal gateway in this network that Azure can use to route traffic back to your on-premises environment.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1j2qg9pcv8xipw4x77p0.png)

## Step 3 - Creating Virtual Network Gateway
**We need to create a Virtual Network Gateway that will become the endpoint to your connections.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uzexrikzna4h5sufifud.png)
 
**Go to “+ Create a resource”, start typing “Virtual network gateway”, and select it to begin configuring.**

```
Now, we need to fill the instance information.
Name: S2SVNGW
Gateway Type: VPN
VPN Type: Router-based
SKU: VpnGw1
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dwzvs4muwcx89edzwxa8.png)

```
Virtual Network:(Our Azure Local Virtual Network)
Public IP Address: Create New
Public IP Address Name: S2SVPNGWIP (In the demo, we can use this name as our Public IP)
Enable Active-Active mode: Disable
Configure BGP ASN: Disable
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o6q8fiia6lflbr31gj2w.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vzljq3ey8nqzc1zafsou.png)
**Click the “Create + Review” button to start the process. It will take more minutes to finish the process.**

## Step 4 - Creating Local Network Gateway
**In this step, we need to create a “Local Network Gateway”. This represents our local on-premises networks. This Gateway shows our on-premises information so that Azure knows where our on-premises are running.**
**Now, we need to fill our correct information.**

```
Name: S2SLNGW
IP Address: 103.59.187.18 – Azure IP Address
[In real situation you have to specify the Static IP address of the on-premises server or the Fully Qualified Domain Name]
Address Space: 192.168.1.0/24 – LAN IP Address Range
Enter the other necessary information and click “Create”.
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gkymalliv6ec77deezl1.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/atnbmq0lp42d1gnu1u9z.png)

## Step 5 - Creating a Connection
**The connection is represented to connect Virtual Network Gateway and Local Network Gateway.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m4449z0bco33ufaxjmda.png)

```
Connection Type: Site-to-Site (IPsec)
Click the “OK” button to finish the basic information.
```

```
In the Virtual Network Gateway, choose the Gateway that we have already created
In the Local Network Gateway, choose the Gateway that we have already created
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5z91tlj95d8749jd958c.png)

**In the Connection Name, it assigns the name itself. If we need to change the name we can do it. Now, we need to assign the Shared Key (PSK) for Secure VPN connection.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/atkqpqbwvhuedlems5rn.png)

**After successfully completing the steps you will find a configuration file. Download this and send the text file to the network engineers on the other side**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1033ur1ne218pj6m3qb9.png)

**After that, we can verify our VPN status in the Connection settings.**
 
**It Will show VPN Status is “Connected” and we can verify the Peer 1 and Peer 2.**