Make request to on-prem service through "transit" vNet - azure

I have an Azure vNet A that is peered to the on-prem network. I want to make a TCP request to on-prem service from another vNet B. Is it possible to use vNet A as "transit" network to redirect traffic to the on-prem service? The restriction is vNet B cannot use peering, virtual kubelet doesn't support it.

If you can't use VNET peering try to deploy Virtual Network Gateway in vNetB. Then connect
vNetA and vNetB gateways using VNet-2-VNet connection type.

Related

Question concerning forward traffic on Azure Virtual Networks

I have a routing problem which I am struggling to solve in the Azure cloud platform concerning traffic that needs to be routed from one vnet to another vnet via another vnet and two VPN tunnels.
Here is a description of the set-up:
I do have two Azure Virtual Networks (VNET1 and VNET2) that each one has its own route-based Azure VPN Gateway and one 3rd party virtual network (VNET3) which is connected to the first Azure virtual network VNTE1 via an IPsec VPN tunnel. Below are the address spaces of all 3 virtual networks.
VNET1 10.20.0.0/16 (Azure vnet)
VNET2 10.30.0.0/16 (Azure vnet)
VNET3 10.0.0.0/12 (3rd party vnet)
Here is what I can do:
The VNET1 is connected via an IPsec VPN tunnel with the VNET3. Thus I am able to ping from a VM in the VNET1 10.20.10.5 a VM in the VNET3 10.0.0.1 and they can ping me back.
The VNET1 is connected via an IPsec VPN tunnel with VNET2. Thus, I am able to ping from a VM in the VNET1 10.20.10.5 a VM in the VNET2 10.30.10.5
Here what i cannot do:
I cannot ping from a VM in the VNET2 10.30.10.5 the VM in VNET3 10.0.0.1.
Here is what I tried to do to solve the problem without any success so far:
My assumption is that the network VNET2 does not know how to route the traffic to the network VNET3. Thus, I created an Azure Route table and I assigned the route table to the subnet 10.30.10.0/24 and I created the rule that all the traffic to the network 10.0.0.0/12 should be routed to the VPN GateWay of the VNTE2. My expectation is that once the traffic will go to the GW it will reach the VNET1 which knows how to route it to the VNET3. This didn't work.
Although I think is not needed since VNET1 already knows how to route the traffic to the VNET3 I have also created a routing table for 10.0.0.0/12 similar to the one above. This didn't help either.
Am I missing a route somewhere, If so which rule and where? Or do I even need to have a VM acting as a router? (I hope not)
I think your issue is the limitation of Azure Virtual Gateway:
The on-premises networks connecting through policy-based VPN devices with this mechanism can only connect to the Azure virtual network; they cannot transit to other on-premises networks or virtual networks via the same Azure VPN gateway.
https://learn.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-connect-multiple-policybased-rm-ps
So, even if you use the same VPN Gateway to connect with VNET 3 and VNET 2, by design VNET 3 and VNET 2 cannot communicate.
To resolve this issue, I recommend to use peering. Your configuration is similar to classic Hub-Spoke topology. Your VNET1 is Hub, VNET2 is Spoke, VNET3 is kind of "on-prem".
No changes needed to configuration between VNET1 and VNET3. You need to establish peering between VNET1 and VNET2 and backwards and apply following configuration:
Configure the peering connection in the hub to allow gateway transit.
Configure the peering connection in each spoke to use remote gateways.
Configure all peering connections to allow forwarded traffic.
https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/hybrid-networking/hub-spoke
In this case, VNET3 will be able to communicate with HUB (VNET1) and all spokes (VNET2 and any others connected to VNET1). VNET2 can communication with HUB (VNET1) and on-prem (VNET3) when the tunnel is up.
Warning: Spokes are not able to communicate between each other without a forwarding gateway in HUB, i.e. if you add VNET4 with peering to and from VNET1, VNET4 will not able to ping VMs in VNET2. But they could communicate with HUB and on-prem without any additional appliances.

How to integrate Azure Web App with a VNet with gateway transit

I have two VNets: A and B.
VNet B has a VPN gateway and connected to an on-premise network. VNet A is peered with VNet B with transit gateway enabled. This works perfectly for virtual machines. I deploy VMs to VNet A and can access on-premise resources from there VMs.
Now I want to deploy a Web App and connect it to VNet A, so the web app will have access to on-premise resources. But to do so, I need to add a VPN gateway into the network A, which is impossible when the network is peered with another network with Use remote gateway option on. But I need this option to be on to have access to on-premise resources.
What should I do? How I can give access from Web App to on-premise resources without using App Service Environment? Is it possible?
Basically, I need the combination of these two schemes
In this case, you should integrate with VNet B from the Azure web app. Also, It will be integrated with a point-to-site VPN enabled VNet. There is a new version of the VNet Integration feature that is in preview. It doesn't depend on point-to-site VPN. From your scenario, the web app is working like " VPN clients" in a P2S connection on the second picture.
Here are some things to keep in mind before connecting your web app to a virtual network:
A target virtual network must have point-to-site VPN enabled with a
route-based gateway before it can be connected to app. The VNet must
be in the same subscription as your App Service Plan(ASP). The apps
that integrate with a VNet use the DNS that is specified for that
VNet.
Ref: https://learn.microsoft.com/en-us/azure/app-service/web-sites-integrate-with-vnet

How can I connect an azure app service plan to a vnet which is also connected through peering to another vnet

I am trying to seup this hub-spoke toplogy where I have a hub vnet connected to an expressroute circuit https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/hybrid-networking/hub-spoke
I have another VNET (lets call it the app vnet) set up with peering to this hub VNET where I can create a virtual machine and ping resources on the other end of just fine using the remote gateway setting on the peering.
The problem is by using remote gateway, my app vnet cannot have its own gateway, and so I cannot integrate an app service plan with the vnet.
Is there another way I could accomplish this?
I would like to suggest setting up a VNet-to-VNet VPN gateway connection instead of Vnet peering between hub vNet and app vNet. If so, Each of vNet will have their own gateway. The App vNet will be integrated with your web app. You need to ensure that the address prefixes don’t overlap among all the connected networks.
Update
Perhaps you can use the new preview VNet Integration.
There is a new version of the VNet Integration capability that doesn't
depend on Point-to-Site VPN technology. Unlike the pre-existing
feature, the new Preview feature will work with ExpressRoute and
Service Endpoints.
The new version is in Preview and has the following characteristics.
No gateway is required to use the new VNet Integration feature You can
access resources across ExpressRoute connections without any
additional configuration beyond integrating with the ExpressRoute
connected VNet. The app and the VNet must be in the same region
...
Ref: https://learn.microsoft.com/en-us/azure/app-service/web-sites-integrate-with-vnet#new-vnet-integration
The limitation that you are encountering is from the Vnet gateway perspective. Using remote gateway over peering handicaps one from deploying the Gateway in that Vnet.
The alternative as suggested by #nancy should do the trick. But, you will have to incur the cost of having the gateway. Secondly, this will require a co-existence set-up.
That is you will have to deploy another VPN gateway:
Change of reference:
VNET-HUB (Your hub VNET with ExR)
VNET-SPOKE1 (Current peered as referred to as your Application VNet)
Your VNET-HUB has an ExR gateway, it needs to have another VPN gateway.
Your VNET-SPOKE1 needs to have a VPN gateway deployed as well.
Allowing for the VNET-HUB to talk to the App Service Environment that you would integrate via point-to-site.
Note: The On-premise will not be able to access the App VNet as we can't have a Point-to-site co-exist with Express Route.
I hope this has provided an insight into the limitations.
References/good reads:
https://learn.microsoft.com/en-us/azure/expressroute/expressroute-routing
https://learn.microsoft.com/en-us/azure/expressroute/expressroute-howto-coexist-classic
https://learn.microsoft.com/en-us/azure/expressroute/expressroute-faqs
https://learn.microsoft.com/en-us/azure/app-service/environment/app-service-app-service-environment-network-configuration-expressroute

Connect to an on-premise network from an external computer via an Azure VPN Gateway

My goal is to connect from an external computer to both a Azure virtual network as well as a small on-premise network via an Azure VPN Gateway:
The Azure virtual network has the address range 10.1.0.0/16.
The on-premise network has the address range 10.2.0.0/16.
So far, I have done the following:
Set up a virtual gateway on the virtual network.
The virtual gateway is configured as a point-to-site VPN gateway.
The virtual gateway is connected to the on-premise network via a site-to-site connection.
So the topology looks like this:
VPN-client =p2s=> Azure =s2s=> On-premise
I can now dial in via VPN, but I can only ping addresses within the virtual network. On-premise addresses are not reachable.
I have also added the line
ADD 10.2.0.0 MASK 255.255.0.0 default METRIC default IF default
to the routes.txt file on the VPN client, but it's still not working.
This is not possible to achieve this.
Why
First, Azure VNet is a logic isolation and segmentation. Each virtual network is isolated from other virtual network.
When you try to connect the VNet Via P2S VPN, your client can communicate with resources in the VNet. But it cannot direct the traffic out of the VNet.
When you try to connect the VNet via S2S VPN, your site can communicate with the resources in the VNet.But it cannot direct the traffic out of the VNet.
Because they are using different Gateway and have different CIDR and Azure VNet cannot route the inbound traffic to one specify outbound gateway.
For Example
VNetA <peering or VPN gateway> VNetB <peering or VPN gateway> VNetC
But VNetA cannot communicate with VNetC
This is important for Azure VNet to reach isolation and segmentation.

Azure Virtual network gateway

We have successfully setup the VPN Tunnel from our On-premise DC to Azue Vnet (Let say VNet1) and now we are trying to access another VNet (Let say VNet2) which is connected to VNet1 via peering but we are unable to access VNet2 from our On-premise N/w. Please let me know if you have any solution for this.
You can enable "Allow transit" when within create VNet peering.
Please see following site:
Azure Virtual Networks - Transit Routing - Between IPsec & VNet Peering
https://social.technet.microsoft.com/wiki/contents/articles/35830.azure-virtual-networks-transit-routing-between-ipsec-vnet-peering.aspx
VNet Peering and Gateway Transit with S2S VPN
http://www.deployazure.com/network/virtual-network/vnet-peering-and-gateway-transit-with-s2s-vpn/

Resources