Azure Site-to-Site VPN

 Azure Site-to-Site VPN — Detailed Resource-by-Resource Creation

  1. First, create an Azure Virtual Network (VNet) with an address space, for example 10.0.0.0/16.
  2. Inside the VNet, create a dedicated subnet named GatewaySubnet. Azure requires this subnet for deploying VPN gateways.
  3. 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)
  4. Create a Public IP Address that will be assigned to the VPN Gateway.
  5. Deploy an Azure VPN Gateway into the GatewaySubnet and associate the Public IP with it.
  6. On the on-premises side, identify the VPN device or firewall and note its public IP address.
  7. In Azure, create a Local Network Gateway representing the on-premises network. This contains:
    • On-premises public IP
    • On-premises private network ranges
  8. Create a VPN Connection between the Azure VPN Gateway and the Local Network Gateway.
  9. Configure the same shared secret (pre-shared key) on both the Azure VPN Gateway and the on-premises firewall.
  10. Once the IPSec/IKE tunnel is established, the Azure VPN Gateway securely exchanges routes with the on-premises network.
  11. When a user from the on-premises network sends traffic to an Azure VM, the traffic reaches the on-premises firewall first.
  12. The firewall encrypts the traffic and sends it through the VPN tunnel over the Internet.
  13. The encrypted traffic reaches the Azure VPN Gateway through its Public IP address.
  14. The Azure VPN Gateway decrypts the traffic inside the GatewaySubnet.
  15. The gateway then routes the traffic to the correct subnet within the VNet, such as the Web, App, or Database subnet.
  16. The Azure resource responds to the request.
  17. 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

FieldValue
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


FieldExample
NameProd-VNet
RegionCentral India


IP Address Tab

Address Space

Example:

10.0.0.0/16

Meaning:

  • Entire VNet range
  • Supports many subnets


📌 Why /16?

Allows many subnet allocations later.


SubnetPurpose
WebSubnetWeb servers
AppSubnetAPIs
DBSubnetDatabases
GatewaySubnetVPN gateway


🌐 STEP 4 — CREATE GATEWAYSUBNET (VERY IMPORTANT)


📌 What it is

Special subnet used ONLY for:

  • VPN Gateway
  • ExpressRoute Gateway

FieldValue
NameGatewaySubnet
Range10.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

FieldValue
NameVPNGW-PIP
SKUStandard
AssignmentStatic


📌 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

FieldValue
NameProd-VPNGW
Gateway TypeVPN
VPN TypeRoute-based
SKUVpnGw1
GenerationGen2
VNetProd-VNet
Public IPVPNGW-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

FieldExample
NameHQ-OnPrem
Public IP1.2.3.4
Address Space192.168.1.0/24

📌 Meaning

Tells Azure:

  • Where on-prem VPN device exists
  • Which network is behind it
🔐 STEP 8 — CREATE VPN CONNECTION

📌 What it is

Creates IPsec tunnel relationship.


🔧 Portal Steps

Go to:

Connections
→ Add

FieldValue
Connection TypeSite-to-site (IPsec)
VNet GatewayProd-VPNGW
Local Network GatewayHQ-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

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.

🔥 Example Scenario (Very Common in Companies)

SideDetails
On-prem branch officeFortiGate firewall
Azure VNet10.20.0.0/16
Office LAN192.168.10.0/24
Azure VPN Gateway IP52.172.45.10
Pre-shared keyForti@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:


SettingValue
IKE VersionIKEv2
EncryptionAES256
AuthenticationSHA256
DH Group14
Lifetime28800

STEP 5 — Configure IPsec Phase 2


SettingValue
Local Subnet192.168.10.0/24
Remote Subnet10.20.0.0/16
EncryptionAES256
AuthenticationSHA256
PFSEnabled
DH Group14
Lifetime3600

STEP 6 — Create Routes (VERY IMPORTANT)

Network → Static Routes → Create New

FieldValue
Destination10.20.0.0/16
GatewayIPsec 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 Up

Expected status:

Tunnel: UP

Comments

Popular posts from this blog

Azure Migrate

All Kuberneters - Components

SOW - Template - Example