Forum Discussion
DensuShiv
Nov 11, 2021Copper Contributor
Local Network Gateway to Virtual Network Gateway - how does it know which vNet to use
Was trying out the example from Microsoft Documentation: Exercise - Create a site-to-site VPN gateway by using Azure CLI commands - Learn | Microsoft Docs While overall the concept is str...
LainRobertson
Nov 11, 2021Silver Contributor
So, conceptually, the commands you've dropped in above relate to defining the virtual - or VPN - network. At this early stage, you haven't reached the point of connecting it to anything.
Going back to basics, before you can connect two VPN networks, you need to actually define what those networks look like - which is what these commands are achieving. After these commands are done, you've defined what the VPN network looks like but nothing is connected - that comes later in section 4 of the exercise.
Technically, in having now defined the VPN network, you could walk away and it'd happily sit there doing nothing, waiting for something to come along on the other end and connect.
In short, section 3 had you setting up the IP-level routing to establish connectivity between Azure and HQ. Section 4 sees you then layer the VPN on top of that basic IP connectivity established in section 3.
The "joining" of the VPN network to the "physical" network is achieved through section 4, step 2 of "Create the Azure-side VPN gateway", where you're binding the VPN network to the "GatewaySubnet" subnet defined earlier in section 3.
It's all much the same as the steps you have to do on any other kind of VPN server. You just have to to a bit more in this lab as you aren't coming from the position of already having the physical layer established. But the concepts of specifying the VPN specifics (IP ranges, gateway addresses/interface exposed on, routes, etc.) are the same.
DensuShiv
Nov 11, 2021Copper Contributor
Thanks for your response. The place I am a bit lost is the binding part. None of the above commands point to the VPN vNet created in earlier steps - Azure-VNet-1.
During the creation of LNG-HQ-Network or VNG-Azure-VNet-1 or the connection Azure-VNet-1-To-HQ-Network using the above commands there is nowhere we are specifying Azure-VNet-1 as the vnet to connect to. Without specifying this vnet in these commands, how does the binding happen?
- LainRobertsonNov 11, 2021Silver Contributor
Yeah, I think the chronology could be a little better, but looking in the direction of Azure-to-HQ it's essentially it's a combination of:
- Section 3, Azure resources, step 2: this subnet glues the later VPN vnet to something "physical" (for want of a better-yet-shorter definition);
- Section 3, Azure resources, step 3: create the local gateway definition pointing to HQ (i.e. outbound routing specification);
- Section 4, Create Azure VPN gateway, step 2: this is what glues the currently free-floating VPN vnet to a "physical" routing component - created in point 1 above.
And then you've got the same in reverse for HQ, but that's not as interesting as it's just a lab substitute for real world HQ-side physical configuration.
Using the picture from the start of section 3, the line dropping down from PIP-VNG-Azure-VNet-1 to GatewaySubnet is what's giving the Azure-side VPN vnet its connectivity to HQ.