Site to Site connection with VPN Gateway & NAT Rules - azure

I have 2 Tenants in Azure, within Tenant 1 I have a Vnet/Snet with 2 VM’s VM1 (10.114.202.92) VM2 (10.114.202.94)
Tenant 1 is having a vnet peering with vnet 2 where I have vnet/GatewaySubnet and my VPN Gateway.
My VPN Gateway has a public IP : 108.142.240.204 and Local Network Gateway Public IP (213.144.3.248) Address Space (217.7.130.224/27) to establish site to site connection to an on Prem Site.
The goal is, that Tenant 1 and Onprem Site can communicate over Tenant 2 where I have the vpngw.
Now the problem is that Onprem Site allows only traffic to them from IP’s from following subnet 198.18.3.244/30 because Traffic coming from 10.114.x.x my overlap with their internal IP’s
Now im struggling to define needed NAT Rules. Is someone able to help me out ?
Overal solution Diagram
NAT RULES i tried

You can use NAT rules to translate the source IP address into a legitimate IP address range that is allowed by your on-premises site. When traffic is coming from your VNet.
You can set up a NAT rule in Tenant 2's VPN gateway to translate traffic coming from the VNet in Tenant 1's source IP address 10.114.XXXX to an IP address in the 198.18.XXXrange like below:
Created NAT rule like below:
Created connections:
Try to associate the NAT rules with each connection add your local network gateway and select ingress NAT rule and Egress NAT rule like below:
Note that NAT is supported on the the following SKUs: VpnGw2~5, VpnGw2AZ~5AZ. You can check the limitations and supported NAT features
Set up a new public IP address resource in Tenant 2 that will be utilised for NAT translation and Create a new NAT rule in the VPN gateway of Tenant 2 that translates the source IP address of traffic coming from the VNet in Tenant 1 to the public IP address and Update the VPN connections between Tenant 2 and your on-premises location so that traffic from Tenant 1 is routed through the public IP address created as the source IP address.
References:
Configure NAT on Azure VPN Gateway - Azure VPN Gateway | Microsoft Learn
About NAT on VPN Gateway - Azure VPN Gateway | Microsoft Learn

Related

Azure Firewall: How to translate Internet URL to Internal/Intranet URL?

I have created the following Vnets
vnet-hub-poc-hubspoke is the Hub Vnet
and both the Vnets are peered as per the HUB-SPOKE model
vnet-hub-poc-hubspoke being a Hub Vnet, it has Azure firewall configured
both the Vnets are connected to Azure Private DNS
Azure Private DNS has a record pointing to the VM deployed on the vnet-prod-poc-hubspoke Vnet
and I could access the FQDN within the internal network
after adding the below rule in Azure Firewall, I could access the website using the firewall public IP
Now, instead of firewall public IP I want to use the domain name like
http://myfirstweb.private.landingzonedomain.com/ (for now, I have updated the hosts file in the client machine pointing to firewall public IP)
what should I do at the azure firewall level so that it would translate Internet URL to Internal/Intranet URL like
http://myfirstweb.private.landingzonedomain.local/
What you want is not possible, because you cannot assign a domain name to your Azure Firewall. What you could do is to create a DNS record at a domain name provider that translates a custom domain to your Azure firewall public IP.
Although I have seen people routing inbound traffic in their vnet, Azure firewall is mainly designed for controlling outbound traffic and traffic flowing between (peered) vnets. When you want to direct inbound traffic to a website or service inside your vnet, you can choose between:
Application Gateway
Frontdoor
Combination of both
All the options above allow you to add custom domains and certificates. On the other hand, when you want to access a virtual machine through rdp or ssh, your main options are:
Bastion host (i.e. jumpbox)
VPN
Cloud Shell

Where can I found the configuration of my VNet with my Web-App on Azure?

The scenario in here is that I have created a WebApp which has Dynamic Outbound IPs, and we needed those IPs to get whitelisted on the DB side, Since there were too many IPs, we created a NAT Gateway, VNet and a single Public IP address through which we will communicate to the DB.
I need to know where lies the configuration for VNet with my Azure web app?
You need to whitelist the public IP address to your firewall of DB because NAT provides source network address translation (SNAT) for a subnet.
NAT gateway resources specify which static IP addresses virtual
machines use when creating outbound flows. Static IP addresses come
from public IP address resources, public IP prefix resources, or both.
If a public IP prefix resource is used, all IP addresses of the entire
public IP prefix resource are consumed by a NAT gateway resource. A
NAT gateway resource can use a total of up to 16 static IP addresses
from either.
If you have enabled web app with VNet Integration, By default, BGP routes affect only your RFC1918 destination traffic. If WEBSITE_VNET_ROUTE_ALL is set to 1, all outbound traffic can be affected by your BGP routes.

Can you route Point-to-site traffic through Azure Firewall?

It seems like there are a lot of traffic routing options when using Azure's Point-to-site VPN but I can't find any details on when you're connected through the Azure VPN client. Can you, then, send that traffic out through the Azure Firewall egress point. We don't use the default Azure Egress because we need our Azure traffic to come from a single IP (from the AFW)
Any ideas if you can route the traffic coming in from the Client VPN, out through the Azure Firewall?
You need to add a UDR on the gateway subnet with a route stating that if the destination IP is subnet range of your VM, next hop Virtual Appliance as Azure Firewall IP(Private IP).
So the traffic from your P2S client reaches VPN gateway, and will be forwarded to the Firewall.
You need to configure DNAT rules in your Azure Firewall to forward the packets to the correct destination.
Let me know if you have any questions.

Virtual network peering connection azure

I have the following three virtual networks: - VNETa - VNETb - VNETc All the network traffic between the three virtual networks will be routed through VNET1a.
need to create the virtual networks, and then to ensure that all the Azure virtual machines can connect to other virtual machines by using their private IP address.
The solutions must NOT require any virtual gateways and must minimize the number of peerings. What should you do from the Azure portal before you configuring IP routing?
You could make peering between VNETa and VNETb, peering between VNETa and VNETc. Without a virtual network gateway and without a separate peering connection between those spokes VNETb and VNETc, to make the spoke connectivity, you need to deploy a virtual appliance as the hub in the network VNETa, then make two UDRs in each spoke VNets VNETb and VNETc to route traffic from one spoke network to another spoke network via NVA. In this scenario, you must configure the peering connections to allow forwarded traffic. see the explanation link.
For more details of UDR configuration, you could refer to this blog about Azure Networking - Hub-Spoke with NVA and Azure Firewall
The key to answering this question is to understand that the question is indicating that an IP routing solution will be configured after you have provisioned the necessary resources and configured appropriately: "...before you configure IP routing".
You do not need a gateway subnet or virtual gateways to implement a hub and spoke topology assuming that you are going to provision, for example, a VM with IP Forwarding enabled on the vNIC to act as a router.
Create your 3 subnets, in your example VNETa, VNETb and VNETc
From VNETa, create a peering with VNETb using the Resource Manager Deployment Model
Ensure "Allow forwarded traffic from VNETa to VNETb" is enabled
Repeat steps 2 & 3, substituting VNETb for VNETc
And that's it. Now when you configure IP routing you will provision a router VM or some other Network Virtual Appliance (NVA) in the hub network and create a Route Table for later application to VNETb and VNETc specifying the router VM's internal IP as the next hop.
Jamie.

Azure network security group and Application Gateway

I have the next azure setup:
Application gateway balancer with it's own vnet .
Two vms in Application gateway backend pool which have their own vnet and a network security group applied to the vms.
Main problem:
How can I instruct the network security group to allow http/https traffic only from the application gateway ?
What I've tried :
a) added inbound rule in network security group with source having tag AzureBalancer . Is not working . Probes are telling me that the vms are in an unhealthy state.
b) I've peered the two vnets and I've added an inbound rule having source tag VirtualNetwork . Same as above, probes telling me that the vms are in an unhealthy state.
c) I've added an inbound rule in nsg to allow traffic only from the public ip of the application gateway. This is working fine , probes are seeing the vms in a healthy state.
The only problem is that the public ip address of the application gateway is dynamic and it cannot be made static.
So when the ip will change my rule will not work.
I am curios to find out how to make this setup works.
All the examples I saw on azure documentation site are with one single vnet with multiples subnets.
If there is an NSG on Application Gateway subnet, port ranges 65503-65534 should be opened on the Application Gateway subnet for Inbound traffic. These ports are required for the backend health API to work.
I've copied the above sentence verbatim from this document: https://learn.microsoft.com/en-us/azure/application-gateway/application-gateway-diagnostics
... as I ran into the same issue. After adding the above to my NSG, my health-check probes worked.
The only problem is that the public ip address of the application
gateway is dynamic and it cannot be made static.
You are right, for now, we can't set application gateway public to static.
And we can't add NSG inbound rules with application gateway FQDN.
As a workaround, we can use internal IPs as backend pool members, connect them with vnet peering or VPN gateway.

Resources