On-Prem and Azure Site-to-Site VPN Connection
![](https://blog.kakaocdn.net/dn/mNKQv/btsLdZHegyR/K77LfLwvoO3hjeMP5xyYS1/img.png)
Hello and welcome to today’s post! In this one, I will show how to create a Site-to-Site connection between an Azure Network and one that is On-Prem.
In order to complete these following steps, you will need to have some prerequisite:
- An Azure Virtual Network
- An Azure Windows Virtual Machine
- An up and running Windows Server
This is the plan for today’s post:
- Part 1: Create a Gateway subnet
- Part 2: Create a Network Gateway
- Part 3: Create a Local Network Gateway
- Part 4: Configure Server for connection
- Part 5: Create an Azure connection and verify connectivity
Part 1: Create a Gateway subnet
- Go to your Azure Virtual Network page. Under settings, click subnets.
- Click + Gateway subnet.
![](https://blog.kakaocdn.net/dn/J9TyD/btsLc3Rf7Oh/cyNiJ28dkTLIsJTPkhVnPK/img.png)
- Enter a subnet address range and click Save.
![](https://blog.kakaocdn.net/dn/bL6IVU/btsLbQSYiFo/PkDLsTKkGStSe9DtMXPi9K/img.png)
Part 2: Create a Network Gateway
- In the search bar, enter virtual network gateways and click on the choice given as shown below.
![](https://blog.kakaocdn.net/dn/bUzv5D/btsLcYP3Ps3/OkLeslV6WsHdRBABjKC3o1/img.png)
- Click Create.
![](https://blog.kakaocdn.net/dn/cQLS0F/btsLcsYoXkr/XzNRIkGkph6M15Jsyfayek/img.png)
- Enter the Name for the gateway.
- In the SKU field, enter VpnGw1.
- In the Virtual network field, select the appropriate network that you want to connect. That network is the same that contains the Gateway subnet that we created earlier.
![](https://blog.kakaocdn.net/dn/cmidbj/btsLd0zmMGt/RWntFNyrYnzkEhzj5U4wpk/img.png)
- In the Public IP address field select Create new.
- In the Public IP address name, enter a name recognizable name.
- Click Review + Create, then Create.
![](https://blog.kakaocdn.net/dn/eUpoLN/btsLcuBSwVR/MIJGeUNTYdZGNLLWFkSIzK/img.png)
Part 3: Create a Local Network Gateway
- In the search bar, type Local network gateways as shown below.
![](https://blog.kakaocdn.net/dn/kzk9u/btsLdlDX47S/LsJtnuhKNQbRAvNxFnejc1/img.png)
- Click Create
![](https://blog.kakaocdn.net/dn/wBYNr/btsLdb9scYc/KmGO94TteR6B1d0zAEErvK/img.png)
- Enter Name.
- Enter the IP address of your Router.
- Enter the Address Space of you local network.
- Click Review + Create, then Create.
![](https://blog.kakaocdn.net/dn/dAHHpT/btsLcY3ATnR/4CyLKkYBqxX2bY9kZVd5R1/img.png)
Part 4: Configure Server for connection
Part 4.a: Add Remote Access feature
- In your server manager dashboard top bar, click Manage then Add Roles and Features.
![](https://blog.kakaocdn.net/dn/r3MPQ/btsLc0mOTCh/7wGPVQ6njGegpibj2zhK10/img.png)
- Click Next until the Server Roles page then check Remote Access.
- Click next until you get to Select Role services page.
![](https://blog.kakaocdn.net/dn/XzvAo/btsLdbInCeb/nYviEz37yx4HUm2RC5oOU1/img.png)
- Check Routing. (DirectAccess and VPN (RAS) will be automatically selected.)
![](https://blog.kakaocdn.net/dn/cVYD22/btsLbaEfVqH/AV5SrsP3IIzG1blLDZ6Lhk/img.png)
- Click Add Features then click next until you get to the confirmation page.
![](https://blog.kakaocdn.net/dn/dxJddA/btsLdw6rQsC/qJaKNKhe2xUuDxAHLknYc1/img.png)
- Click Install
![](https://blog.kakaocdn.net/dn/tXhgx/btsLbXdaNzL/AURKRLsxRsW6Ef2FlOufK0/img.png)
- When the installation is complete, click Close.
![](https://blog.kakaocdn.net/dn/eG0YDB/btsLcXXR8Dz/cDClhwE8HTbjHOK3yw1aAK/img.png)
Part 4.b: Configure Routing and Remote Access
- On the top bar of the server manager, click Tools, then Routing and Remote Access.
![](https://blog.kakaocdn.net/dn/bvL8cJ/btsLcXXR8yp/Ek4oGxVutVCA4rHJOJZYkk/img.png)
- On the Routing and Remote Access, right click on the Server icon then click Configure and Enable Routing and Remote Access.
![](https://blog.kakaocdn.net/dn/PEAeW/btsLc3DKq5M/V0ZVJ16n3EvoNIxRZ02xmK/img.png)
- Select Custom configuration, then click next.
![](https://blog.kakaocdn.net/dn/cXXrKH/btsLbySylTT/2oX0IYuj52OPXb2r8Y8DIk/img.png)
- Check VPN access and LAN routing then click next.
![](https://blog.kakaocdn.net/dn/bOo3dT/btsLbYpAWPn/dmffXKpZwSREIC0ppGdIXK/img.png)
- Click Finish.
![](https://blog.kakaocdn.net/dn/EkKwh/btsLdHfJxLW/QCPIMNYqwTxeQ5kwFoyjkk/img.png)
- Click Start service.
![](https://blog.kakaocdn.net/dn/0N0Ud/btsLcGB6hJW/lq1BSqdVrw0IUeLyLdZKX1/img.png)
Part 4.c: Create a new Network Interface
- Back on the Routing and Remote Access window, right click Network Interface, then New Demand-dial Interface.
![](https://blog.kakaocdn.net/dn/mrqeK/btsLdnBNnb2/ykKKKCLi0fwi8rpXMyaik0/img.png)
- Enter a Name for the interface then click next.
![](https://blog.kakaocdn.net/dn/beJglE/btsLdZULbfc/hcK8fph74IL9s5AUJkmKLk/img.png)
- Select Connect using virtual networking (VPN) then click Next.
![](https://blog.kakaocdn.net/dn/YT6gY/btsLbU8BGPq/sdKjKdwoRm3l9smYtQAPZk/img.png)
- Select IKEv2 then click next.
![](https://blog.kakaocdn.net/dn/bC5J1b/btsLdYn0ZNE/3kMaMQU4lbGrpcI8iK3M4k/img.png)
- Enter the public IP address of the Virtual Network Gateway that we created earlier then click Next.
![](https://blog.kakaocdn.net/dn/ncCic/btsLdkZp74k/PwpkHsMzJXKqUdjf3aHr3K/img.png)
- Check Route IP packets on this interface, then Next.
![](https://blog.kakaocdn.net/dn/25mZb/btsLcq7jba8/dv4FtPp8QINUWPZFg0YEZk/img.png)
- Click Add.
![](https://blog.kakaocdn.net/dn/9HWsV/btsLc5BuWne/oFflB2rCpLqPKculktr0xK/img.png)
- Enter the Cloud Destination address and Mask.
- Enter 10 for Metric, then click OK. (Metric specifies the priority)
![](https://blog.kakaocdn.net/dn/KcoUH/btsLdXo6uZb/yvQHhdgoq0tkwLlYVTtqC1/img.png)
- Click Finish
![](https://blog.kakaocdn.net/dn/N2px3/btsLcZg9umf/cKw9D07qk7WoX71SjPXKdK/img.png)
- Right Click on the newly created interface, then click Properties.
![](https://blog.kakaocdn.net/dn/4xeaB/btsLco9vLYW/3SMg2jh1fXfqZZEH7zQAOk/img.png)
- In the Option tab, select Persistent connection
![](https://blog.kakaocdn.net/dn/nu9k8/btsLctQqxco/BQAsWf1NRAqKMjQNZnmMa0/img.png)
In the Security tab, select Use preshared key for authentication and enter a Key that we will use later, then click OK.
![](https://blog.kakaocdn.net/dn/bp7D6k/btsLcw0FHIc/e8N9ryhvQ0FotWBeibXIgK/img.png)
Part 5: Create an Azure connection and verify connectivity
- Back in Azure, search for Connections.
![](https://blog.kakaocdn.net/dn/cbmvoC/btsLc5hgHul/qHtSCyJDQ8kVDzG7hlJmWk/img.png)
- Click Create
![](https://blog.kakaocdn.net/dn/bam8eh/btsLc5uKpUs/FF4DX4HC9yNOgX7mKnrzMK/img.png)
- Select Site-to-site (IPsec) for Connection type.
- Enter a Name for the connection and click Next.
![](https://blog.kakaocdn.net/dn/bbV3ju/btsLdm3WWMY/52EzaPQSUXDew7lKKeP830/img.png)
- Select the appropriate Virtual network gateway and Local network gateway that we created at the beginning.
- In the Shared key field, enter the Preshared Key that we created earlier and click Review + create, then Create.
![](https://blog.kakaocdn.net/dn/GWwZ5/btsLcLQSXBv/3F21MvrgCfcoguklHoHIZk/img.png)
- After the deployment is complete, click Go to resource.
![](https://blog.kakaocdn.net/dn/bcr1tz/btsLbuoXSkN/5qnBaBi1Wxhmq8x1NImkE0/img.png)
- Notice the status says Not Connected.
![](https://blog.kakaocdn.net/dn/chKesZ/btsLbvapKp5/EHBzuieK01pcUgYsLteza0/img.png)
Back in the Server manager Routing and Remote Access window, right click the Interface that we created earlier and click Connect.
![](https://blog.kakaocdn.net/dn/ceIvon/btsLdwMab2n/kT1RCs1ieAaejQUyRs3AE0/img.png)
![](https://blog.kakaocdn.net/dn/bRGItv/btsLcrSIKdv/k4spqPyQ6pSkyl7okvz401/img.png)
- Back in the Connection page on Azure, click Refresh and notice the status says Connected. (It might take a few minutes to update).
![](https://blog.kakaocdn.net/dn/cCVyPc/btsLb1zXzo8/Mx3j7RNSEYEQJUunUcskzK/img.png)
- Test the connection by Pinging the cloud machine with its private IPv4 address to test the connection. (Make sure the cloud machine firewall allows Pings from the internal network.)
![](https://blog.kakaocdn.net/dn/bjrSsu/btsLdbVUNrD/g5p2zv0skMF9Df2BJTke01/img.png)
This wraps up this post on Setting up a Site-to-Site connection between an on-prem network and an Azure network.
Thank you for reading!