Skip to content

This task contains two vnets, creates a site-to-site vpn with bgp enabled. This code has to execute twice using terraform. Please go through the readme file.

Notifications You must be signed in to change notification settings

sree7k7/azure-Vnet-to-Vnet-BGP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vnet to Vnet BGP connection

Scope

  • Vnet-to-Vnet BGP peering connection. diagram

Prerequsites

  1. Clone this repo and change below parameters or keep default. Note: Change these parameters described in later steps: vpngw_bgp_peering_address and vpngw2_bgp_peering_address
variable "resource_group_location" {
  default     = "northeurope"
  description = "Location of the resource group."
}

# --- VPNGW1 ----

variable "vnet1_cidr" {
  default = ["10.4.0.0/16"]
  description = "azure vnet cidr"
}
variable "vnet1_subnet_address" {
  default = ["10.4.1.0/24"]
}
variable "vnet1_gateway_subnet_address" {
  default = ["10.4.3.0/27"]
}
variable "vnet1_bastion_subnet_address" {
  default = ["10.4.4.0/24"]
}
variable "vpngw_bgp_peering_address" {
  default = "10.4.3.30"
  description = "Enter this value after creating vpn gateway, as of now keep default"
}

# --- VPNGW2 ----
variable "vnet2_cidr" {
  default = ["10.6.0.0/16"]
  description = "azure vnet cidr"
}
variable "vnet2_subnet_address" {
  default = ["10.6.1.0/24"]
}
variable "vnet2_gateway_subnet_address" {
  default = ["10.6.3.0/27"]
}
variable "vnet2_bastion_subnet_address" {
  default = ["10.6.4.0/24"]
}
variable "vpngw2_bgp_peering_address" {
  default = "10.6.3.30"
  description = "Enter this value after creating vpn gateway, as of now keep default"
}
  1. execute below cmds:
   terraform init
   terraform plan
   terraform apply

Note: If fails, try to execute: terraform init -upgrade on terminal and execute cmd: terraform apply.

  1. This is a tricky part somehow terrafrom doesn't allow to import the vpn gateway private ip.
  • Copy both the Virtual Network Gateway BGP peer IP address shown in below pic:

  • Paste the bgp peer ip in above variables.tf file for parameters:

    • vpngw_bgp_peering_address
    • vpngw2_bgp_peering_address
  1. Execute the command in terminal: terraform apply

  2. Connect the VM's using bastion host:

    • In global search, Navigate to your Virtual Machines.
    • Click: connect → bastion
  3. Open browser enter destination VM private ip.

Links:

About

This task contains two vnets, creates a site-to-site vpn with bgp enabled. This code has to execute twice using terraform. Please go through the readme file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages