Azure VM can't reach remote network with connected VPN - azure

I am setting up an Azure VPN Gateway in order for my Azure VM to connect to a remote RTSP feed, following this documentation: https://learn.microsoft.com/fr-fr/azure/vpn-gateway/tutorial-site-to-site-portal.
What I have done:
Create a virtual network + a subnet and a Virtual Machine
Create the VPN Gateway in the same virtual network
Create a local network gateway with the Public IP and IPs range of the remote network that contains the RTSP feeds
Create the site to site VPN connection with needed shared access key.
The status of the VPN connection is "connected", as you can see in below picture:
Moreover, the subnet on which my azure virtual machine is, is in the same virtual network as the subnet of the VPN Gateway:
From what I understand, as long as the VM is in the virtual network of the Gateway, I should be able to reach the remote network...
Expected behaviour: I should be able to reach the following IP addresses: 192.168.250.30/32 that are on the remote network, from my azure virtual machine.
Actual behavior: From my azure virtual machine, I'm still unable to reach the remote network.
Any ideas where the problem can come from?

If the issue is that the Azure VM's are not getting gateway routes, then a gateway reset should be tried first and the gateway reset needs to be done twice.
Reference :
VPN gateway Reset
References for S2S VPN issues troubleshooting:
S2S VPN cannot connect and stops working
S2S VPN disconnects intermittently
Note : If this doesn’t solve your issue then please reach out to Azure support for more troubleshooting as it may need assisted support by clicking (Support+Help) and creating a technical support request. Please validate your Onprem VPN device as well.
And as Andriy Bilous has mentioned in comments section:
You should see default gateway on your VM routing table. Default Gateway is responsible for routing traffic further. Can you see that
tunnel is UP on your VPN onpremise device.
If no VPN Gateway subnet (10.0.0.0/28) in your VM route table - You may add route to VM using route command. Example: route ADD 10.0.0.0
MASK 255.255.255.240 [Your Gateway IP address]

Related

How do I know that a Virtual Machine in Azure use the Local network gateway route to connect to an on-premise network?

Here a Data engineer who needs your help to setup a connection to an on-premise environment :)!
I have created a virtual network (10.0.0.0/16) with a default subnet (10.0.0.0/24).
Then I created a (Windows) virtual machine which is connected to the vnet/subnet and has allowed ICMP inbound and outbound rules for the ping test. Ping google.com is no problem.
The next step was to create a Virtual network gateway & Local network gateway to connect to an on-premise environment.
The Local network gateway has an Site-to-site (IPsec) connection to a VPN device from a third party (over which I have no control). Status in the Azure portal = 'Connected'.
The third party is able to ping the Virtual Machine in Azure, the 'data in' property on the VPN connection shows that 2 kb (ping) has been received. So that works!
When i try to send a ping command to the ip-address (within the 'address space' specified from the Local network gateway) the ping command fails (Request timed out.).
After a lot of searching on google/stackoverflow I found out that I need to configure a Route Table in Azure because of the BGP = disabled setting. So hopefully I did a good job configure the Routing Table Routes but still I can't perform a successful ping :(!
Do you guys/girls know which step/configuration I have forgotten or where I made a mistake?
I would like to understand why I cannot perform a successful ping to the on-premise environment. If you need more information, please let me know
Site-to-site (IPsec) connection screenshot/config
Routing Table setup screenshot/config
Routing Table Routes in more detail
If you are NOT using BGP between the Azure VPN gateway and this particular network, you must provide a list of valid address prefixes for the Address space in your local network gateway. The address prefixes you specify are the prefixes located on your on-premises network.
In this case, it looks like you have added the address prefixes. Make sure that the ranges you specify here do not overlap with ranges of other networks that you want to connect to. Azure will route the address range that you specify to the on-premises VPN device IP address. There are no other operations that we can do. We don't need to set UDR, especially we don't associate a route table to the Gateway Subnet. Also, avoid associating a network security group (NSG) to the Gateway Subnet. You can check the route table by selecting Effective routes for a network interface in Azure VM. Read more details here.
If you would like to verify the connection from Azure VNet to an on-premise network, ensure that you PING a real private IP address from your on-premise network(I mean the IP address is assigned to an on-premise machine), you can check the IP address with ipconfig/all in local CMD. Moreover, you could Enable ICMP through the Windows firewall inside the Azure VM with the PowerShell command New-NetFirewallRule –DisplayName "Allow ICMPv4-In" –Protocol ICMPv4. Or, instead of using PING, you can use the PowerShell command Test-NetConnection to test a connection to a remote host.
If the problem persists, you could try to reset the Azure VPN gateway and reset the tunnel from the on-premises VPN device. To go further, you could follow these steps to identify the cause of the problem.

How to access internet from azure point to site vpn (Not working)?

I set up the Point to site vpn in azure vnet with virtual network gateway which is working fine using openvpn . Now i can able to connect to azure vm via private ip but i could not able to access internet from my Host Machine (Local machine where i connected my vpn ).
**Before VPN Set up i can able to connect to Internet Please click below for ping results **
Before VPN connected ping results
**After VPN Set up i cannot able to connect to Internet Please click below for ping results **
After VPN connected ping results
For the Host Machine to be blocked something must have changed on the Host machine or on the subnet on which it is located.
When setting up a VPN, you should set up a gateway subnet that is used only for that.
Have you used the subnet on which the VM is located as the gateway subnet?

Azure P2S client traffic to S2S network

My VNet won't allow me to connect to the s2s location via p2s connection.
I'm trying to connect the Azure VPN client on my machine and reach a site that is allowed in a network which I have a s2s connection to.
Here's the thing, I can't get traffic to flow from my pc running the VPN client, out to the target site.
Topology
PC > VPN Client > VNet via p2s > Remote network via s2s > FTP server
I'd like to be able to ping the FTP server from my machine.
Currently only devices in the VNet can ping.
I tried setting up BGP but it broke the connection, as I don't really know how things should be set.
I don't have access to the remote site or it's devices.
I have a Azure local network gateway which is configured as the s2s location.
I'm sorry if that doesn't make sense.
Edit: here is the picture of the network
BGP is the standard routing protocol which enables the Azure VPN Gateways and your on-premise VPN devices to exchange "routes" that will inform both gateways on the availability and reachability for those prefixes to go through the gateways or routers involved.
To configure the BGP, your on-premise device should also support BGP. Read
What address does Azure VPN gateway use for BGP Peer IP?
What are the requirements for the BGP Peer IP addresses on my VPN device?
What should I specify as my address prefixes for the Local Network Gateway when I use BGP?
Without BGP, If you add the point-to-site addresses after you create your site-to-site VPN connection, you need to update the routes manually. You need to manually add the routes to the remote network on your machine.
For more information, you could refer to configure and validate virtual network or VPN connections. Except the Ping tool, you prefer to use TCping tool, see the detailed steps.
Generally, you could troubleshoot the issue by searching the common issue and solution in the virtual network gateway---Diagnose and solve problems on Azure portal. It's recommended to new a support ticket to get your issue resolved quickly.
My solution to this as I can't enable BPG is to use a proxy server within the VNet.

Azure OpenVPN appliance not traversing virtual network gateway

I deployed an openvpn virtual appliance and clients can reach peered networks, the VNET of the appliance itself, but not the network onpremise that is reachable via the virtual network gateway (routed VPN). When I use the P2S OpenVPN provided from Azure clients can reach onpremise network. What am I missing ?
I deployed an OpenVPN appliance because Azure OpenVPN lacks ccd support.
I solved the problem by adding the OpenVPN client IP range to the VNET address space. I then created a subnet with the same IP range. Obviously, you can't put any resource in this subnet. By then adding this subnet to the route, OpenVPN clients could traverse the gateway.
After my test on my windows client, I can directly access the on-premise network from the Azure VPN gateway based VNet or access the resources in the VPN based VNet from the on-premise network. You could follow these tutorials:
Configure a Point-to-Site connection to a VNet using native Azure certificate authentication: Azure portal
Set up OpenVPN® Protocol on Azure VPN Gateway.
Configure OpenVPN clients for Azure VPN Gateway
I have not deployed an OpenVPN virtual appliance, but I think it will be something like this: Point-to-Site (P2S) connection using OpenVPN infrastructure
According to this quick start, If you use a virtual VPN appliance, It is necessary to create a routing table on Azure so that traffic to your VPN subnet is directed back to your VPN instance and enable IP forwarding for this network interface. You could get more details about custom routes.
Feel free to let me know if I am misunderstanding you.

Azure web app can't see VM through vnet-to-vnet connection

I have a VM running a WebAPI service that I want to hit from an Azure web app using a vnet-to-vnet conneciton. As such, I have the VPNs configured as follows:
Virtual Machine - VMVnet
Address Space: 10.1.0.0/16
Subnet: 10.1.0.0/24
Gateway Subnet: 10.1.1.0/27
Private IP: 10.1.0.4
I also opened the target port up in Windows Firewall.
Web App - AppVnet
Address Space: 10.2.0.0/16
Subnet: 10.2.0.0/24
Gateway Subnet: 10.2.1.0/27
I also have Virtual Network Gateways configured for both, each with a connection going to the other.
Now, after I connect the app to AppVnet and sync the routes from the app service plan's networking section, I should be able to hit the VM using its private IP from the app code. When I try, I get the following error:
An attempt was made to access a socket in a way forbidden by its access permissions
I also tried setting up Virtual Network Peering between the networks, but that didn't work either.
Is what I'm trying to do even possible with Azure web apps? I saw this question, which seemed like what I was looking for but the information in it is a bit lacking.
If not, I have tried this with a point-to-site configuration with the app connected to the VM's vnet, and it worked fine. Would it be preferable to set up a second nic on the VM using the AppVnet and connect all apps through that?
I'm just wondering why neither the vnet-to-vnet nor vnet peering works
with the web app
First of all, you need to know to Integrate your app with an Azure Virtual Network.
Here are some things to keep in mind before connecting your web app to
a virtual network:
If your target virtual network already exists, it must have point-to-site VPN enabled with a Dynamic routing gateway before it can
be connected to an app.
If your gateway already exists with point-to-site enabled, and it is not in the basic SKU, IKEV2 must be disabled in your point-to-site
configuration.
That is to say, you already have a P2S connection that you can connect to AppVnet from your App. If you want to connect to VMVnet through the AppVnet from your app, you can achieve it by gateway transit for virtual network peering in hub-and-spoke network architecture.
In the diagram, gateway transit allows the peered virtual networks to use the Azure VPN gateway in Hub-RM. In this case, your AppVnet is the Hub-RM. Your web app is the VPN client in a P2S VPN connection.
I am not sure that you real configuration in your side, but I guess your creating Vnet to Vnet connection is just like Hub-RM to Spoke-RM connection in the diagram, so it does not work. Setting up Vnet peering and gateway transit enabled, it should work. For more details about Configure VPN gateway transit for virtual network peering.

Resources