Skip to content

Commit 277764c

Browse files
committed
content sync
1 parent c1d1300 commit 277764c

1 file changed

Lines changed: 34 additions & 19 deletions

File tree

site/content/en/post/2026/03/azure-to-lab-connectivity.md

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,21 @@ So in case you haven't heard...there are no DIMMs! Well, there are if you want
3434

3535
And that's what's bringing us this next cursed episode of "Ken has to figure things out" - lift and shifting workloads into the cloud cause we can't have no old servers.
3636

37-
I've got a migration to run - moving VMs from vSphere to Azure Red Hat OpenShift. Should work, but of course I'm not exposing my vCenter and hosts to the Internet - so for this I need to make a VPN connection of sorts from Azure to/from my lab.
37+
I've got a migration to run - moving VMs from vSphere on-prem to Azure Red Hat OpenShift. Should work, but of course I'm not exposing my vCenter and hosts to the Internet - so for this I need to make a VPN connection of sorts from Azure to/from my lab.
3838

3939
I'm running a Unifi stack here which natively supports a few different VPN options, so this is the process I took to set up a VPN between Microsoft Azure and my garage to securely schlep VMs around.
4040

4141
---
4242

4343
## Architecture
4444

45-
So before we begin, a little overview of what's going to be used in the cloud and on-prem in my lab:
45+
Before we begin, a little overview of what's going to be used in the cloud and on-prem in my lab:
4646

4747
### Lab Network
4848

4949
- `192.168.42.0/23` - Lab Network, has vCenter
5050
- `192.168.60.0/23` - OpenShift Network
51+
- `192.168.42.11` - On-prem private DNS Server
5152
- `kemo.labs` - Private zone that runs my things
5253

5354
### Azure Network
@@ -64,19 +65,20 @@ So before we begin, a little overview of what's going to be used in the cloud an
6465

6566
## Azure VPN Setup
6667

67-
1. If you haven't already, create a Virtual Network (VNet) in Azure. If you're using Azure Red Hat OpenShift then you already have a VNet created. Note that the default VNet Address Space probably only accounts for the node IP pools - I had to expand the Address Space to make room for the Virtual Gateway subnet that we'll create in a second.
68-
2. With the VNet and it's subnets in place, search for "Virtual Network Gateway" and create a new one.
69-
3. For my example I'm running a non-redundant VPN - mostly because I don't want to do BGP routing between my site and the cloud. Below you can see the settings I used to create the VNet Gateway.
70-
4. After you click Create, go take a walk - a long one. Took about an hour for my VNet Gateway to spin up.
71-
5. Next we'll create a **Local Network Gateway** in the Virtual Network Gateway. The Local Network Gateway is defined in Azure that represents the public IP address of your on-prem network - doesn't have to be static, so long as it doesn't change too often. If it does change or you use something like DynDNS then just give it the FQDN instead. Map some of the local networks you'll tunnel into Azure by defining the subnets in the LNG.
72-
6. Now we go BACK to the Virtual Network Gateway, in the left pane navigate to "VPN Gateway > Connections" and make a new Connection. This glues the VNG and LNG together and actually spins up the VPN. You'll want to use the Site-to-Site IPSec type of VPN Connection. What's important in the Settings page for the VPN Connection is to set the IPSec/IKE Policy to "Custom" - then set the two phases' Encryption to "AES256", Integrity to "SHA256", and Groups to "2" like shown in the screenshots below. Generate a long PSK and store it in a secure password vault of some sort.
73-
7. Wait for the VPN Connection to be created - once it is, grab the IP Address of the Virtual Network Gateway, we'll need that to configure the Unifi side of things
68+
1. If you haven't already, **create a Virtual Network** (VNet) in Azure. If you're using Azure Red Hat OpenShift (ARO) then you already have a VNet created. Note that the default ARO VNet Address Space only accounts for the node IP pools in a `/22` - I had to expand the Address Space to a `/20` to make room for the Virtual Gateway subnet and DNS endpoint subnets that we'll create in a second.
69+
2. With the VNet and it's subnets in place, search for **"Virtual Network Gateway"** and create a new one.
70+
3. For my example I'm running a non-redundant VPN - mostly because I don't want to do BGP routing between my site and the cloud. Below you can see the settings I used to create the VNet Gateway. The VNet Gateway will need its own Subnet, a `/26` will do.
71+
4. After you click Create, go take a walk - *a long one*. Took about an hour for my VNet Gateway to spin up.
72+
5. Next we'll create a **Local Network Gateway** in the Virtual Network Gateway. The Local Network Gateway is defined in Azure and represents the public IP address of your on-prem network - doesn't have to be static, so long as it doesn't change too often. If it does change or you use something like DynDNS then just give it the FQDN instead. I'm not using BGP so I just needed to add some of the local networks that will be tunneled into Azure by defining the subnets in the LNG.
73+
6. Now we go *BACK* to the Virtual Network Gateway, in the left pane navigate to "**VPN Gateway > Connections**" and make a new Connection. This glues the VNG and LNG together and actually spins up the VPN. You'll want to use the Site-to-Site IPSec type of VPN Connection.
74+
7. What's important in the Settings page for the VPN Connection is to set the IPSec/IKE Policy to "Custom" - then set the two phases' Encryption to "AES256", Integrity to "SHA256", and Groups to "2" like shown in the screenshots below. Generate a long PSK and store it in a secure password vault of some sort.
75+
8. Wait for the VPN Connection to be created - once it is, grab the Public IP Address of the Virtual Network Gateway, we'll need that to configure the Unifi side of things
7476

7577
---
7678

7779
## Unifi Setup
7880

79-
1. In the Unifi Network dashboard, navigate to Settings > VPN then click the tab for "Site-to-Site VPN" and create a new one.
81+
1. In the Unifi Network dashboard, navigate to **Settings > VPN** then click the tab for "Site-to-Site VPN" and create a new one.
8082
2. VPN type will be IPSec, give it a name and that Pre-Shared Key from earlier that we configured in Azure's VPN Connection.
8183
3. Set the Local IP for the WAN IP you configured in Azure's Local Network Gateway.
8284
4. The Remote IP / Hostname will be the Public IP Address from the Virtual Network Gateway in Azure.
@@ -85,32 +87,32 @@ So before we begin, a little overview of what's going to be used in the cloud an
8587
7. Configure the Encryption/Hash/Group as you did on the Azure side, so AES0256, SHA256, and 2.
8688
8. Leave the rest as the default settings and click Add. It might take a moment for the tunnel to be established but eventually you should see "Online". Azure seems to be a bit slow with updating things so give it a little time and you should also see "Connected" in the VPN Connection.
8789

88-
The VPN tunnel is now established! But it's still barely usable. Next up we'll need to create some Routes so that things can get between the two infrastructure providers.
90+
The VPN tunnel is now established! But it's still barely usable - we'll need to create some Routes so that things can get between the two infrastructure providers.
8991

9092
---
9193

9294
## Azure Routing Setup
9395

9496
Next we need to create a few things in Azure so that it can route to the on-premise environment. Namely a Route Table.
9597

96-
1. In Azure, search for "Route Table" and create a new one.
97-
2. With the Route Table created, access the resource and navigate to Settings > Routes. Create a new Route.
98+
1. In Azure, search for **"Route Table"** and create a new one.
99+
2. With the Route Table created, access the resource and navigate to Settings > Routes. **Create a new Route**.
98100
3. Give it a name, Destination Type should be "IP Addresses" and give it the CIDR range that's on the other side of the tunnel - in my case I have 2 so I'll need to make Routes for each subnet.
99101
4. Set the Next Hop Type to "Virtual Appliance" and set it to the WAN IP of the on-prem network that was configured in the Local Network Gateway.
100102
5. Rinse/repeat for as many subnets as you have to route.
101103

102-
Now to test this, you can go into a Virtual Machine that's in the VNet that we configured all this stuff for and do a quick `ping/ssh on-prem-address-here` - for my environment I just used a debug terminal on one of the Azure Red Hat OpenShift nodes.
104+
Now to test this, you can go into an Azure Virtual Machine that's in the VNet that we configured all this stuff for and do a quick `ping/ssh on-prem-address-here` - for my environment I just used a debug terminal on one of the Azure Red Hat OpenShift nodes.
103105

104106
> Note: If the ping fails, it is likely due to needing to open some Firewall rules in Unifi, source being VPN and the instance configured, and the destination being the routed network.
105107
106108
---
107109

108110
## Unifi Routing Setup
109111

110-
Now if you just need to get to assets on-prem FROM Azure, you can skip this next step, but I like bi-directional communication when possible - helps make sure things are working right on both ends.
112+
Now if you just need to get *TO* assets on-prem *FROM* inside of Azure, you can skip this next step, but I like bi-directional communication when possible - helps make sure things are working right on both ends.
111113

112-
1. In the Unifi Network dashboard, navigate to Settings > Policy Engine > Policy Table.
113-
2. Create a new Static Route - should be a Gateway type, Distance of 1, and give the Next Hop Address the Public IP Address from the Virtual Network Gateway in Azure.
114+
1. In the Unifi Network dashboard, navigate to **Settings > Policy Engine > Policy Table**.
115+
2. Create a new **Static Route** - should be a Gateway type, Distance of 1, and give the Next Hop Address the Public IP Address from the Virtual Network Gateway in Azure.
114116
3. Set a destination network, in this case it's the Azure VNet being `10.0.0.0/20`
115117

116118
With that configured you should now be able to connect to Azure resources from the on-premise environment! I tested by doing an SSH connection test to one of the ARO nodes, didn't have the SSH key but still good to test the connection/firewall/security groups are acting right.
@@ -123,7 +125,7 @@ While we're here in the Unifi dashboard, if the previous `ping`/`ssh` test from
123125

124126
Now that the Site-to-Site tunnel is setup, IP connectivity is looking good, last thing we need is to resolve DNS things - no good connecting things if you have to remember octets.
125127

126-
1. In Azure, search for "DNS Private Resolvers" and create a new one.
128+
1. In Azure, search for **"DNS Private Resolvers"** and create a new one.
127129
2. Set it in the intended RG/VNet.
128130
3. Skip creating an Inbound/Outbound Endpoints and Rulesets, we'll do that once the Resolver is created.
129131

@@ -133,7 +135,7 @@ Once the DNS Private Resolver is created, let's work on the Endpoints.
133135

134136
The Inbound Endpoint is simply a little DNS resolver that runs in Azure and takes queries for for Private Zones defined in Azure. With this you can point your on-prem DNS stack to send queries for zones in Azure to the Inbound Endpoint to resolve.
135137

136-
1. With the DNS Private Resolver resource loaded, navigate to Settings > Inbound Endpoints and create a new one.
138+
1. With the DNS Private Resolver resource loaded, navigate to **Settings > Inbound Endpoints** and create a new one.
137139
2. Give it a name, and create a new Subnet, default /28 should work fine. You don't want to give it an existing subnet (unless you know that's the architecture you want) because each subnet can only have ONE Endpoint type.
138140
3. IP address assignment can be Dynamic, Azure will keep up with the updates - unless you have a specific static IP you'd rather use.
139141

@@ -147,3 +149,16 @@ The Outbound Endpoint is a DNS resolver that runs in Azure that forwards queries
147149
2. Give it a name, and create a new Subnet, default /28 should work fine. You don't want to give it an existing subnet (unless you know that's the architecture you want) because each subnet can only have ONE Endpoint type.
148150
3. Click Create - super boring, the real fun is with the Rulesets.
149151

152+
### DNS Forwarding Rulesets
153+
154+
With the Endpoints created, next we need to make a few Rulesets so that Azure can forward specific requests for specific zones to my on-prem DNS servers.
155+
156+
1. In Azure search for **"DNS Forwarding Rulesets"** and create a new one
157+
2. Give it a name and a place to live in a Resource Group.
158+
3. Select the DNS Private Resolver and Outbound Endpoint previously created.
159+
4. **Skip creating a Rule or Virtual Network Link** - there seems to be a bug with how the Azure GUI validates things.
160+
5. Finish creating the Ruleset and once it's created let's go back to it's Settings page to create a Rule/Link.
161+
6. **Create a Rule** - the Domain Name in my instance is `kemo.labs.` (note the dot at the end) and set the Destination IP as the on-prem DNS server, in my case being `192.168.42.11`.
162+
7. **Create the Virtual Network Link** - at the time of writing there seems to be a little bug with the Azure GUI where the pre-selected Resource Group fails validation, so toggle back/forth to the RG that the VNet Link should live in. Select the VNet as well, the default generated name should be fine (probably isn't if you have standards).
163+
164+
And now with all that in the mix, you should be able to resolve queries for Zones that are hosted on-prem, from Azure! I tested this with a quick `dig vcenter.kemo.labs` from one of the debug terminals on an ARO node and it worked great - post that, I just added my vCenter Provider in the Migration Toolkit for Virtualization, ran a quick migration test, and before I knew it had a Windows VM migrated from my on-prem lab into Azure Red Hat OpenShift...*pretty neat!*

0 commit comments

Comments
 (0)