Issue communicating Cloud Function with VM in another VPC with error upstream request timeout

Hi, I am setting up VPN tunneling within 2 different projects for secure communication. This setup is being tested to connect Cloud Functions with on-prem VM.
I am able to setup VPN tunnelling through Classic VPN gateway and I can see the traffic successfully through ping and curl using private IP.
Now, I want to hit private IP of on-prem VM via cloud functions to test connectivity but it throws "upstream request timeout"

I checked everything, configurations of subnet and others are similar to what I have used for VM testing.

 

2 2 120
2 REPLIES 2

hi, referring to above context, I am able to hit the VM from Cloud function once I set VPC peering.

Can anyone help me to understand is it because I am using VPN Gateway with Policy or Route based routing. I tried both ways but no luck. 
I have bit confusion in terms of BGP based routing. Can this be achieved with BGP?

Hi @dikshant-infra ,

From what you've mentioned, you've successfully configured VPN tunneling between your on-premise VMs and Cloud Functions. However, while attempting to use Cloud Functions to reach the on-premises virtual machine's private IP, you are running into a "upstream request timeout".

You can consider checking the firewall rules. Make sure that your firewall rules allow traffic to flow between the Cloud Functions and the on-prem VM. You can check the firewall rules in the Cloud Console, under the VPC network section. 

Also, The "upstream request timeout" error could be caused by an issue with the Cloud Functions code or configuration. You can check the logs for the Cloud Functions in the Cloud Console to see if there are any errors or warnings that could help you diagnose the issue.


@dikshant-infra wrote:

Can anyone help me to understand is it because I am using VPN Gateway with Policy or Route based routing. I tried both ways but no luck. 
I have bit confusion in terms of BGP based routing. Can this be achieved with BGP?


Regarding your question about VPN gateways with policy or route-based, chances are, if the problem you're experiencing is unrelated to the route you're using Policy and route based access are methods appropriate way to configure VPN gateways , and they should work in theory. However, there may be specific issues in your configuration that cause an "upstream request timeout" error.

As for BGP-based routing, BGP can be used for VPC peering. When you set up VPC peering with BGP, the two networks use BGP to exchange routing information, so that they can actually learn about each other’s routes and make routing decisions based on this information

To configure VPC peering with BGP, you will need to configure BGP policies on the Cloud side as well as on-prem side. This typically requires specifying BGP parameters, such as BGP peers, BGP authentication keys, and BGP ASNs (autonomous system numbers). You can find more information about configuring VPC peering and BGP in this documentation.