Set up a regional internal proxy Network Load Balancer with hybrid connectivity Stay organized with collections Save and categorize content based on your preferences.
The regional internal proxy Network Load Balancer is a proxy-based regional Layer 4 load balancer thatenables you to run and scale your TCP service traffic behind an internal IPaddress that is accessible only to clients in the same Virtual Private Cloud (VPC)network or clients connected to your VPCnetwork. If you want to make the service available to clients in otherVPC networks, you canuse Private Service Connectto publish the service.
This page describes how to configure a regional internal proxy Network Load Balancer to load balancetraffic to backends on-premises or in other cloudenvironments that are connected by usinghybridconnectivity. Configuring hybrid connectivityto connect your networks to Google Cloud is not in scope for this page.
Overview
In this example, we'll use the load balancer to distribute TCP traffic acrossbackend VMs located on-premises or in other cloud environments.
In this example, you configure the following deployment:
The regional internal proxy Network Load Balancer is a regional load balancer. All load balancer components(backend instance groups, backend service, target proxy, and forwarding rule)must be in the same region.
Permissions
To set up hybrid load balancing, you must have the following permissions:
On Google Cloud
- Permissions to establish hybrid connectivity between Google Cloud andyour on-premises environment or other cloud environments. For the listof permissions needed, see the relevantNetwork Connectivity productdocumentation.
- Permissions to create a hybrid connectivity NEG and the load balancer.TheCompute Load Balancer Adminrole(
roles/compute.loadBalancerAdmin) contains the permissions required toperform the tasks described in this guide.
On your on-premises environment or other non-Google Cloud cloudenvironment
- Permissions to configure network endpoints that allow services on youron-premises environment or other cloud environments to be reachable fromGoogle Cloud by using an
IP:Portcombination. For more information,contact your environment's network administrator. - Permissions to create firewall rules on your on-premises environment orother cloud environments to allow Google's health check probes to reach theendpoints.
- Permissions to configure network endpoints that allow services on youron-premises environment or other cloud environments to be reachable fromGoogle Cloud by using an
Additionally, to complete the instructions on this page, you need to create ahybrid connectivity NEG, a load balancer, and zonal NEGs (and their endpoints)to serve as Google Cloud-based backends for the load balancer.
You should be either a projectOwneror Editor, or you should have thefollowingCompute Engine IAMroles.
| Task | Required role |
|---|---|
| Create networks, subnets, and load balancer components | Compute Network Admin (roles/compute.networkAdmin) |
| Add and remove firewall rules | Compute Security Admin (roles/compute.securityAdmin) |
| Create instances | Compute Instance Admin (roles/compute.instanceAdmin) |
Optional: Use BYOIP addresses
With bring your own IP (BYOIP), you can import your own public addresses toGoogle Cloud to use the addresses with Google Cloud resources. Forexample, if you import your own IPv4 addresses, you can assign one to theforwarding rule when you configure your load balancer. When you follow theinstructions in this document to , provide the BYOIP address as theIP address.
For more information about using BYOIP, seeBring your own IP addresses.
Establish hybrid connectivity
Your Google Cloud and on-premises environment or other cloud environmentsmust be connected throughhybrid connectivity by usingeither Cloud Interconnect VLAN attachments or Cloud VPNtunnels with Cloud Router or Router appliance VMs. We recommend that youuse a high availability connection.
A Cloud Router enabled withglobal dynamicroutinglearns about the specific endpoint through Border Gateway Protocol (BGP) andprograms it into your Google Cloud VPC network. Regionaldynamic routing is not supported. Static routes are also not supported.
You can use either the same network or a different VPC networkwithin the same project to configure both hybrid networking(Cloud Interconnect or Cloud VPN or a Router appliance VM) and the load balancer. Notethe following:
If you use different VPC networks, the two networks must beconnected using either VPC Network Peering or they must beVPCspokeson the sameNCChub.
If you use the same VPC network, ensure that yourVPC network's subnet CIDR ranges don't conflict with yourremote CIDR ranges. When IP addresses overlap, subnet routes are prioritizedover remote connectivity.
For instructions, see the following documentation:
Important: Don't proceed with the instructions on this page until you set uphybrid connectivity between your environments.Set up your environment that is outside Google Cloud
Perform the following steps to set up your on-premises environment or other cloudenvironment for hybrid load balancing:
- Configure network endpoints to expose on-premises services toGoogle Cloud (
IP:Port). - Configure firewall rules on your on-premises environment or other cloud environment.
- Configure Cloud Router to advertise certain required routes to yourprivate environment.
Set up network endpoints
After you set up hybrid connectivity, you configure one or more networkendpoints within your on-premises environment or other cloud environments thatare reachable through Cloud Interconnect or Cloud VPN orRouter appliance by using anIP:port combination. ThisIP:portcombination is configured as one or more endpoints for the hybrid connectivityNEG that is created in Google Cloud later on in this process.
If there are multiple paths to the IP endpoint, routingfollows the behavior described in theCloud Routeroverview.
Set up firewall rules
The following firewall rules must be created on your on-premises environmentor other cloud environment:
- Create an ingress allow firewall rule in on-premises or other cloud environments to allow traffic from the region'sproxy-only subnet to reach the endpoints.
Allowing traffic from Google's health check probe ranges isn't required for hybridNEGs. However, if you're using a combination of hybrid and zonal NEGs ina single backend service, you need to allow traffic from theGooglehealth check probe ranges for the zonal NEGs.
Advertise routes
Configure Cloud Router toadvertise the following custom IPranges to youron-premises environment or other cloud environment:
- The range of the region's proxy-only subnet.
Set up your Google Cloud environment
For the following steps, make sure you use the same VPC network(calledNETWORK in this procedure) thatwas used to configure hybrid connectivity between the environments. You canselect any subnet from this network to reserve the load balancer's IP addressand create the load balancer. This subnet is referred to as
Additionally, make sure the region used (calledREGION in thisprocedure) is the same as that used to create the Cloud VPN tunnel orCloud Interconnect VLAN attachment.
Configure the proxy-only subnet
Aproxy-only subnet provides aset of IP addresses that Google uses to run Envoy proxies on your behalf. Theproxies terminate connections from the client and create new connections to thebackends.
The proxy-only subnet is used by allEnvoy-based regional loadbalancers in theREGION region of theNETWORK VPC network.
There can only be one active proxy-only subnet per region, perVPC network. You can skip this step if there's already aproxy-only subnet in this region.
Console
If you're using the Google Cloud console, you can wait and create theproxy-only subnet later on theLoad balancing page.
If you want to create the proxy-only subnet now, use the following steps:
In the Google Cloud console, go to theVPC networks page.
Go to the network that was used to configurehybrid connectivity between the environments.
ClickAdd subnet.
Enter aName:PROXY_ONLY_SUBNET_NAME.
Select aRegion:REGION.
SetPurpose toRegional Managed Proxy.
Enter anIP address range:PROXY_ONLY_SUBNET_RANGE.
ClickAdd.
gcloud
Create the proxy-only subnet with thegcloud compute networks subnetscreate command.
gcloud compute networks subnets createPROXY_ONLY_SUBNET_NAME \ --purpose=REGIONAL_MANAGED_PROXY \ --role=ACTIVE \ --region=REGION \ --network=NETWORK \ --range=PROXY_ONLY_SUBNET_RANGE
Reserve the load balancer's IP address
By default, one IP address is used for each forwarding rule. You canreserve ashared IPv4 address, which lets you use the same IPv4 addresswith multiple forwarding rules. However, if you want touse Private Service Connect to publish the loadbalancer,then do not use a shared IPv4 address for the forwarding rule.
To reserve a static internal IPv4 address for your load balancer, seeReserve a new static internal IPv4 or IPv6address.
Note: You cannot reserve ashared static internal IPv6 address.Set up the hybrid connectivity NEG
When creating the NEG, use aZONE that minimizes thegeographic distance between Google Cloud and your on-premises or othercloud environment. For example, if you are hosting a service in an on-premisesenvironment in Frankfurt, Germany, you can specify theeurope-west3-aGoogle Cloud zone when you create the NEG.
Moreover, theZONE usedto create the NEG should be in the same region where the Cloud VPNtunnel or Cloud Interconnect VLAN attachment were configured forhybrid connectivity.
For the available regions and zones, see theCompute Enginedocumentation: Available regions andzones.
Console
Note: You can either create the hybrid connectivity NEG now, or you can waitto create it while configuring the load balancer's backend.To create a hybrid connectivity NEG:
In the Google Cloud console, go to theNetwork endpoint groups page.
ClickCreate network endpoint group.
Enter aName for the hybrid NEG. Referred to asHYBRID_NEG_NAME in thisprocedure.
Select theNetwork endpoint group type:Hybrid connectivity networkendpoint group (Zonal).
Select theNetwork:NETWORK
Select theSubnet:LB_SUBNET
Select theZone:HYBRID_NEG_ZONE
Enter theDefault port.
ClickCreate
Add endpoints to the hybrid connectivity NEG:
In the Google Cloud console, go to theNetwork endpoint groups page.
Click theName of the network endpoint group created in the previousstep (HYBRID_NEG_NAME). Yousee theNetwork endpoint group details page.
In theNetwork endpoints in this group section, clickAdd networkendpoint. You see theAdd network endpoint page.
Enter theIP address of the new network endpoint.
Select thePort type.
- If you selectDefault, the endpoint uses the default portfor all endpoints in the network endpoint group.
- If you selectCustom, you can enter a differentPort numberfor the endpoint to use.
To add more endpoints, clickAdd network endpoint and repeat theprevious steps.
After you add all the non-Google Cloud endpoints,clickCreate.
gcloud
Create a hybrid connectivity NEG using the
gcloud compute network-endpoint-groupscreatecommand.gcloud compute network-endpoint-groups createHYBRID_NEG_NAME \ --network-endpoint-type=NON_GCP_PRIVATE_IP_PORT \ --zone=HYBRID_NEG_ZONE \ --network=NETWORK
Add the on-premises IP:Port endpoint to the hybrid NEG:
gcloud compute network-endpoint-groups updateHYBRID_NEG_NAME \ --zone=HYBRID_NEG_ZONE \ --add-endpoint="ip=ENDPOINT_IP_ADDRESS,port=ENDPOINT_PORT"
You can use this command to add the network endpoints youpreviouslyconfigured on-premises or in your cloud environment.Repeat--add-endpoint as many times as needed.
You can repeat these steps to create multiple hybrid NEGs if needed.
Configure the load balancer
Console
Start your configuration
In the Google Cloud console, go to theLoad balancing page.
- ClickCreate load balancer.
- ForType of load balancer, selectNetwork Load Balancer (TCP/UDP/SSL) and clickNext.
- ForProxy or passthrough, selectProxy load balancer and clickNext.
- ForPublic facing or internal, selectInternal and clickNext.
- ForCross-region or single region deployment, selectBest for regional workloads and clickNext.
- ClickConfigure.
Basic configuration
- Enter aName for the load balancer.
- Select theRegion:REGION.
- Select theNetwork:NETWORK.
Reserve a proxy-only subnet
Note: If you alreadycreated the proxy-only subnet,theReserve subnet button isn't displayed. You can skip thissection and continue with the steps in theBackend configurationsection.To reserve a proxy-only subnet:
- ClickReserve subnet.
- Enter theName:PROXY_ONLY_SUBNET_NAME.
- Enter anIP address range:PROXY_ONLY_SUBNET_RANGE.
- ClickAdd.
Backend configuration
- ClickBackend configuration.
- ForBackend type, selectHybrid connectivity network endpointgroup (Zonal).
- ForProtocol, selectTCP.
- In theHealth check list, clickCreate a health check, and thenenter the following information:
- In theName field, enter a name for the health check.
- In theProtocol list, selectTCP.
- In thePort field, enter
80.
- ClickCreate.
- UnderNew backend, select the hybrid NEG created previously:
HYBRID_NEG_NAME . Or, youcan clickCreate a network endpoint group to create the hybrid NEGnow. For guidance on configuring the NEG, seeSet up the hybridNEG. - Retain the remaining default values and clickDone.
- In the Google Cloud console, verify that there is a check mark next toBackend configuration. If not, double-check that you have completedall of the steps.
Frontend configuration
- ClickFrontend configuration.
- Enter aName for the forwarding rule.
- ForSubnetwork, selectLB_SUBNET.
- ForIP address, selectLB_IP_ADDRESS.
- ForPort number, enter any port number from 1-65535. The forwardingrule only forwards packets with a matching destination port.
- EnableProxy Protocol only if it works with the service running onyour on-premise or other cloud endpoints. For example, PROXY protocoldoesn't work with the Apache HTTP Server software. For more information,seeProxy protocol.
- ClickDone.
- In the Google Cloud console, verify that there is a check mark next toFrontend configuration. If not, double-check that you have completedall the previous steps.
Review and finalize
- ClickReview and finalize.
- Double-check your settings.
- ClickCreate.
gcloud
Create a regional health check for the backends.
gcloud compute health-checks create tcpTCP_HEALTH_CHECK_NAME \ --region=REGION \ --use-serving-port
Health check probes for hybrid NEG backends originate from Envoy proxiesin the proxy-only subnet.
Create a backend service.
gcloud compute backend-services createBACKEND_SERVICE_NAME \ --load-balancing-scheme=INTERNAL_MANAGED \ --protocol=TCP \ --region=REGION \ --health-checks=TCP_HEALTH_CHECK_NAME \ --health-checks-region=REGION
Add the hybrid NEG backend to the backend service.
gcloud compute backend-services add-backendBACKEND_SERVICE_NAME \ --network-endpoint-group=HYBRID_NEG_NAME \ --network-endpoint-group-zone=HYBRID_NEG_ZONE \ --region=REGION \ --balancing-mode=CONNECTION \ --max-connections=MAX_CONNECTIONS
For
MAX_CONNECTIONS, enter the maximum concurrentconnections that the backend should handle.Create the target TCP proxy.
gcloud compute target-tcp-proxies createTARGET_TCP_PROXY_NAME \ --backend-service=BACKEND_SERVICE_NAME \ --region=REGION
Create the forwarding rule.
Create the forwarding rule using the
gcloud compute forwarding-rulescreatecommand.ReplaceFWD_RULE_PORT with a single port number from 1-65535.The forwarding rule only forwards packets with a matching destinationport.
gcloud compute forwarding-rules createFORWARDING_RULE \ --load-balancing-scheme=INTERNAL_MANAGED \ --network=NETWORK \ --subnet=LB_SUBNET \ --address=LB_IP_ADDRESS \ --ports=FWD_RULE_PORT \ --region=REGION \ --target-tcp-proxy=TARGET_TCP_PROXY_NAME \ --target-tcp-proxy-region=REGION
Test the load balancer
To test the load balancer, create a client VM in the same region as theload balancer. Then send traffic from the client to the load balancer.
Create a client VM
Create a client VM (client-vm) in the same region as the load balancer.
Console
In the Google Cloud console, go to theVM instances page.
ClickCreate instance.
SetName to
client-vm.SetZone toCLIENT_VM_ZONE.
ClickAdvanced options.
ClickNetworking and configure the following fields:
- ForNetwork tags, enter
allow-ssh. - ForNetwork interfaces, select the following:
- Network:NETWORK
- Subnet:LB_SUBNET
- ForNetwork tags, enter
ClickCreate.
gcloud
The client VM must be in the same VPC network and region asthe load balancer. It doesn't need to be in the same subnet or zone. Theclient uses the same subnet as the backend VMs.
gcloud compute instances create client-vm \ --zone=CLIENT_VM_ZONE \ --image-family=debian-12 \ --image-project=debian-cloud \ --tags=allow-ssh \ --subnet=LB_SUBNET
Allow SSH traffic to the test VM
In this example, you create the following firewall rule:
fw-allow-ssh: An ingress rule that allows incoming SSH connectivity on TCPport 22 from any address. You can choose a more restrictive source IP rangefor this rule; for example, you can specify just the IP ranges of the systemsfrom which you will initiate SSH sessions. This example uses the target tagallow-sshto identify the test client VM to which it should apply.
Console
- In the Google Cloud console, go to theFirewall policies page.Go to Firewall policies
- ClickCreate firewall rule to create the rule to allow incomingSSH connections:
- Name:
fw-allow-ssh - Network:NETWORK
- Priority:
1000 - Direction of traffic: ingress
- Action on match: allow
- Targets: Specified target tags
- Target tags:
allow-ssh - Source filter:IPv4 ranges
- Source IPv4 ranges:
0.0.0.0/0 - Protocols and ports: ChooseSpecified protocols and ports,and then enter
tcp:22. - ClickCreate.
- Name:
gcloud
Create the
fw-allow-sshfirewall rule to allow SSH connectivity toVMs with the network tagallow-ssh.gcloud compute firewall-rules create fw-allow-ssh \ --network=NETWORK \ --action=allow \ --direction=ingress \ --target-tags=allow-ssh \ --rules=tcp:22
Send traffic to the load balancer
Note: It might take a few minutes for the load balancer configuration topropagate globally after you first deploy it.Now that you have configured your load balancer, you can test sendingtraffic to the load balancer's IP address.
Connect via SSH to the client instance.
gcloud compute ssh client-vm \ --zone=CLIENT_VM_ZONE
Verify that the load balancer is serving backend hostnames as expected.
Use the
compute addresses describecommandto view the load balancer's IP address:gcloud compute addresses describeLB_IP_ADDRESS \ --region=REGION
Make a note of the IP address.
Send traffic to the load balancer on the IP address and port specifiedwhen creating the load balancer forwarding rule. Testing whether thehybrid NEG backends are responding to requests depends on the servicerunning on the non-Google Cloud endpoints.
Optional: Publish the service by using Private Service Connect
A regional internal proxy Network Load Balancer with hybrid connectivity lets you make a service that ishosted in on-premises or other cloud environments available to clients in yourVPC network.
If you want to make the hybrid service available in other VPCnetworks, you can use Private Service Connect topublish the service.By placing a service attachment in front of your regional internal proxy Network Load Balancer, you can letclients in other VPC networks reach the hybrid services runningin on-premises or other cloud environments.
What's next
- To set up monitoring for your regional internal proxy Network Load Balancer, seeUsingmonitoring.
- To learn how a regional internal proxy Network Load Balancer works, see theRegional internal proxy Network Load Balanceroverview.
- Clean up the load balancer setup.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.