Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Accessing Load Balancer from Backend VMs

Hello, I am using a gcp network pass through load balancer(LB). From which two backend VMs are attached.

Is it possible to access the lb from backend VM?
I tried hitting a request from backend VM to LB ip address and it looks like the request is not even leaving the backend VM. Upon some checking I found this.

"The VM thinks that the load balancer IP is one of its own IPs."

Is this true in case of gcp configuration also? If so, how can this be resolved ?

 

1 1 457
1 REPLY 1

Hi @__jatin_3 ,

When you're using a certain type of Load Balancer in Google Cloud, the computers (VMs) that receive the data see the source of that data as if it's coming from the Load Balancer itself. This is done for specific reasons, mainly to keep things organized and ensure that these computers get the data from the same place, regardless of which Load Balancer handles it.

Now, if you're trying to talk to the Load Balancer from one of these computers, it might seem like your message is not going anywhere. That's because, from the computer's perspective, it's like talking to itself, and the message doesn't really leave the computer—it's meant to stay within.

To make this work, you may need to set things up a bit differently, like using a specific internal address instead of the external one, or using a specific service name. Always make sure to check the documentation and understand how these configurations might affect your setup.

To access the load balancer from a backend VM, you may need to configure your load balancer to handle internal traffic differently. You might consider the following suggestions below:

  1. Set up the backend VMs to connect to the internal IP address of the load balancer instead of the external one

  2. If you are using Google Cloud Load Balancing with Service Directory, you can configure backend VMs to access the service by its DNS name rather than the IP address.

  3. You can configure the load balancer to use direct routing, which means that the original source IP address is preserved. However, this might not be suitable for all scenarios and may require additional configuration.

If these recommendations won't work for you, I would suggest you to create a support case associated with your project for further checking and assistance.