Azure Site-to-Site VPN
Azure Site-to-Site VPN — Detailed Resource-by-Resource Creation
- First, create an Azure Virtual Network (VNet) with an address space, for example 10.0.0.0/16.
- Inside the VNet, create a dedicated subnet named GatewaySubnet. Azure requires this subnet for deploying VPN gateways.
-
Create the application subnets such as:
- Web Subnet (10.0.1.0/24)
- App Subnet (10.0.2.0/24)
- DB Subnet (10.0.3.0/24)
- Create a Public IP Address that will be assigned to the VPN Gateway.
- Deploy an Azure VPN Gateway into the GatewaySubnet and associate the Public IP with it.
- On the on-premises side, identify the VPN device or firewall and note its public IP address.
-
In Azure, create a Local Network Gateway representing the on-premises network. This contains:
- On-premises public IP
- On-premises private network ranges
- Create a VPN Connection between the Azure VPN Gateway and the Local Network Gateway.
- Configure the same shared secret (pre-shared key) on both the Azure VPN Gateway and the on-premises firewall.
- Once the IPSec/IKE tunnel is established, the Azure VPN Gateway securely exchanges routes with the on-premises network.
- When a user from the on-premises network sends traffic to an Azure VM, the traffic reaches the on-premises firewall first.
- The firewall encrypts the traffic and sends it through the VPN tunnel over the Internet.
- The encrypted traffic reaches the Azure VPN Gateway through its Public IP address.
- The Azure VPN Gateway decrypts the traffic inside the GatewaySubnet.
- The gateway then routes the traffic to the correct subnet within the VNet, such as the Web, App, or Database subnet.
- The Azure resource responds to the request.
-
The response traffic follows the reverse path:
- Azure Resource → VNet → VPN Gateway → Internet (encrypted) → On-Premises Firewall → User.
One-Line Summary
The Azure VPN Gateway resides inside the GatewaySubnet of a VNet, receives encrypted traffic from external networks, decrypts it, and routes it to the appropriate resources within the VNet.
This explains exactly how every Azure resource is created, what it does, where it resides, and how all components connect in Microsoft Azure.
On-Prem Network (192.168.1.0/24)
|
[Firewall/VPN Device]
|
Public IP: 1.2.3.4
|
================ INTERNET =================
|
Azure VPN Gateway (Public IP)
|
GatewaySubnet
|
Azure VNet (10.0.0.0/16)
|
┌──────────────┬──────────────┐
| | |
AppSubnet DBSubnet WebSubnet
10.0.1.0/24 10.0.2.0/24 10.0.3.0/24
🏗️ STEP 1 — CREATE RESOURCE GROUP
| Field | Value |
|---|---|
| Resource Group | RG-Network-Prod |
| Region | Central India |
📌 Why first?
Every Azure resource must belong to a resource group.
🧱 STEP 2 — CREATE VIRTUAL NETWORK (VNet)
📌 What it is
The VNet is the private Azure network.
Equivalent to:
- Corporate network
- Data center network
🔧 Portal Steps
Go to:
Virtual Networks
→ Create
Field Example Name Prod-VNet Region Central India IP Address Tab
Address Space
Example:
10.0.0.0/16Meaning:
- Entire VNet range
- Supports many subnets
📌 Why /16?
Allows many subnet allocations later.
| Subnet | Purpose |
|---|---|
| WebSubnet | Web servers |
| AppSubnet | APIs |
| DBSubnet | Databases |
| GatewaySubnet | VPN gateway |
🌐 STEP 4 — CREATE GATEWAYSUBNET (VERY IMPORTANT)
📌 What it is
Special subnet used ONLY for:
- VPN Gateway
- ExpressRoute Gateway
| Field | Value |
|---|---|
| Name | GatewaySubnet |
| Range | 10.0.255.0/27 |
📌 Why /27?
VPN gateways need multiple IPs internally.
⚠️ NEVER place:
- VMs
- Firewalls
- Apps
inside GatewaySubnet.
🌍 STEP 5 — CREATE PUBLIC IP FOR VPN GATEWAY
📌 What it is
Azure VPN Gateway needs public internet visibility.
🔧 Portal Steps
Go to:
Public IP Addresses
→ Create
Field Value Name VPNGW-PIP SKU Standard Assignment Static 📌 Why Static?
VPN endpoint must not change IP.
🛰️ STEP 6 — CREATE VIRTUAL NETWORK GATEWAY
📌 What it is
This is the actual Azure VPN appliance managed by Microsoft.
It:
- Terminates VPN tunnels
- Encrypts traffic
- Routes packets into VNet
🔧 Portal Steps
Go to:
Virtual Network Gateway
→ Create
Field Value Name Prod-VPNGW Gateway Type VPN VPN Type Route-based SKU VpnGw1 Generation Gen2 VNet Prod-VNet Public IP VPNGW-PIP 📌 Route-based vs Policy-based
Route-based (recommended)
Uses routing table logic.
Supports:
- BGP
- Modern VPNs
- Better scalability
📌 Deployment Time
Usually:
30–45 minutes
🏢 STEP 7 — CREATE LOCAL NETWORK GATEWAY📌 What it represents
Represents ON-PREMISES network in Azure.
🔧 Portal Steps
Go to:
Local Network Gateway
→ Create
Field Example Name HQ-OnPrem Public IP 1.2.3.4 Address Space 192.168.1.0/24 📌 Meaning
Tells Azure:
🔐 STEP 8 — CREATE VPN CONNECTION
- Where on-prem VPN device exists
- Which network is behind it
📌 What it is
Creates IPsec tunnel relationship.
🔧 Portal Steps
Go to:
Connections
→ Add
Field Value Connection Type Site-to-site (IPsec) VNet Gateway Prod-VPNGW Local Network Gateway HQ-OnPrem Shared Key (PSK) MySecret123 📌 What PSK is
Shared secret used for:
- Authentication
- Tunnel encryption
🔥 STEP 9 — CONFIGURE ON-PREM VPN DEVICE
📌 What happens here
Configure:
- Firewall/router
- VPN tunnel
- IPsec policies
Example Devices
- Cisco ASA
- Palo Alto
- Fortinet
- pfSense
🔥 Example Scenario (Very Common in Companies)Here’s a real-world, most commonly used example of a Site-to-Site VPN setup between a branch office FortiGate and Microsoft Azure.
This is basically what you’ll see in many production environments.
Side Details On-prem branch office FortiGate firewall Azure VNet 10.20.0.0/16 Office LAN 192.168.10.0/24 Azure VPN Gateway IP 52.172.45.10 Pre-shared key Forti@2026Secure!⚙️ STEP-BY-STEP (REALISTIC CONFIG)
STEP 1 — Create VPN Tunnel
On FortiGate:
VPN → IPsec Tunnels → Create New → Custom
Tunnel name: AZURE-S2S
STEP 2 — Set Azure Public IP
Remote Gateway: Static IP IP Address: 52.172.45.10
This is the Azure VPN Gateway public IP.STEP 3 — Set Authentication
Authentication Method: Pre-shared Key
Key: Forti@2026Secure!This must match Azure exactly.
Internet Key Exchange
STEP 4 — Configure IKE Phase 1 (MOST COMMON STANDARD)
This is what 80% of companies use:
Setting Value IKE Version IKEv2 Encryption AES256 Authentication SHA256 DH Group 14 Lifetime 28800 STEP 5 — Configure IPsec Phase 2
Setting Value Local Subnet 192.168.10.0/24 Remote Subnet 10.20.0.0/16 Encryption AES256 Authentication SHA256 PFS Enabled DH Group 14 Lifetime 3600 STEP 6 — Create Routes (VERY IMPORTANT)
Network → Static Routes → Create New
Field Value Destination 10.20.0.0/16 Gateway IPsec tunnel (AZURE-S2S) STEP 7 — Firewall Policies
LAN → Azure
- Source: 192.168.10.0/24
- Destination: 10.20.0.0/16
- NAT: ❌ Disabled
- Service: ALL
- Action: ACCEPT
Azure → LAN
- Source: 10.20.0.0/16
- Destination: 192.168.10.0/24
- NAT: ❌ Disabled
- Action: ACCEPT
STEP 8 — Bring Tunnel UP
VPN → IPsec Monitor → Bring UpExpected status:
Tunnel: UP
Comments
Post a Comment