Checkpoints
Configure internal traffic and health check firewall rules
/ 25
Create a NAT configuration using Cloud Router
/ 25
Configure instance templates and create instance groups
/ 25
Configure the internal Network Load Balancer
/ 25
Configure an Internal Network Load Balancer
- Overview
- Setup and requirements
- Task 1. Configure internal traffic and health check firewall rules
- Task 2. Create a NAT configuration using Cloud Router
- Task 3. Configure instance templates and create instance groups
- Task 4. Configure the internal Network Load Balancer
- Task 5. Test the internal Network Load Balancer
- Congratulations!
- End your lab
Overview
Google Cloud offers internal Network Load Balancing for your TCP/UDP-based traffic. Internal Network Load Balancing enables you to run and scale your services behind a private load balancing IP address that is accessible only to your internal virtual machine instances.
In this lab, you create two managed instance groups in the same region. Then you configure and test an internal Network Load Balancer with the instances groups as the backends, as shown in this network diagram:
Objectives
In this lab, you will learn how to perform the following tasks:
- Create internal traffic and health check firewall rules.
- Create a NAT configuration using Cloud Router.
- Configure two instance templates.
- Create two managed instance groups.
- Configure and test an internal Network Load Balancer.
Setup and requirements
For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.
-
Sign in to Qwiklabs using an incognito window.
-
Note the lab's access time (for example,
1:15:00
), and make sure you can finish within that time.
There is no pause feature. You can restart if needed, but you have to start at the beginning. -
When ready, click Start lab.
-
Note your lab credentials (Username and Password). You will use them to sign in to the Google Cloud Console.
-
Click Open Google Console.
-
Click Use another account and copy/paste credentials for this lab into the prompts.
If you use other credentials, you'll receive errors or incur charges. -
Accept the terms and skip the recovery resource page.
Task 1. Configure internal traffic and health check firewall rules
Configure firewall rules to allow internal traffic connectivity from sources in the 10.10.0.0/16 range. This rule allows incoming traffic from any client located in the subnet.
Health checks determine which instances of a load balancer can receive new connections. For Application Load Balancing (HTTP), the health check probes to your load-balanced instances come from addresses in the ranges 130.211.0.0/22 and 35.191.0.0/16. Your firewall rules must allow these connections.
Explore the my-internal-app network
The network my-internal-app with subnet-a and subnet-b and firewall rules for RDP, SSH, and ICMP traffic have been configured for you.
-
In the Cloud Console, on the Navigation menu (), click VPC network > VPC networks.
Notice the my-internal-app network with its subnets: subnet-a and subnet-b.Each Google Cloud project starts with the default network. In addition, the my-internal-app network has been created for you as part of your network diagram.
You will create the managed instance groups in subnet-a and subnet-b. Both subnets are in the
region because an internal Network Load Balancer is a regional service. The managed instance groups will be in different zones, making your service immune to zonal failures.
Create the firewall rule to allow traffic from any sources in the 10.10.0.0/16 range
Create a firewall rule to allow traffic in the 10.10.0.0/16 subnet.
-
On the Navigation menu (), click VPC network > Firewall.
Notice the app-allow-icmp and app-allow-ssh-rdp firewall rules.These firewall rules have been created for you.
-
Click Create Firewall Rule.
-
Specify the following, and leave the remaining settings as their defaults.
Property Value (type value or select option as specified) Name fw-allow-lb-access Network my-internal-app Targets Specified target tags Target tags backend-service Source filter IPv4 ranges Source IPv4 ranges 10.10.0.0/16 Protocols and ports Allow all
- Click Create.
Create the health check rule
Create a firewall rule to allow health checks.
-
On the Navigation menu (), click VPC network > Firewall.
-
Click Create Firewall Rule.
-
Specify the following, and leave the remaining settings as their defaults.
Property Value (type value or select option as specified) Name fw-allow-health-checks Network my-internal-app Targets Specified target tags Target tags backend-service Source filter IPv4 Ranges Source IPv4 ranges 130.211.0.0/22 and 35.191.0.0/16 Protocols and ports Specified protocols and ports
- For tcp, check the checkbox and specify port 80.
- Click Create.
Click Check my progress to verify the objective.
Task 2. Create a NAT configuration using Cloud Router
The Google Cloud VM backend instances that you setup in Task 3 will not be configured with external IP addresses.
Instead, you will setup the Cloud NAT service to allow these VM instances to send outbound traffic only through the Cloud NAT, and receive inbound traffic through the load balancer.
Create the Cloud Router instance
-
On the Google Cloud console title bar, type Network services in the Search field, then click Network services in the Products & Page section.
-
On the Network service page, click Pin next to Network services.
-
Click Cloud NAT.
-
Click Get started to configure a NAT gateway.
-
Specify the following, and leave the remaining settings as their defaults.
Property Value (type value or select option as specified) Gateway name nat-config Network my-internal-app Region -
Click Cloud Router, and select Create new router.
-
For Name, type nat-router-
. -
Click Create.
-
In Create Cloud NAT gateway, click Create.
Click Check my progress to verify the objective.
Task 3. Configure instance templates and create instance groups
A managed instance group uses an instance template to create a group of identical instances. Use these to create the backends of the internal Network Load Balancer.
This task has been performed for you at the start of this lab. You will need to SSH into each instance group VM and run the following command to setup the environment.
-
On the Navigation menu, click Compute Engine > VM instances.
Notice the instances that start with instance-group-1 and instance-group-2. -
Select the SSH button next to instance-group-1 to SSH into the VM.
-
If prompted allow SSH-in-browser to connect to VMs, click Authorize.
-
Run the following command to re-run the instance's startup script:
-
Repeat the previous steps for instance-group-2.
-
Wait for both startup scripts to finish executing, then close the SSH terminal to each VM. The output of the startup script should state the following:
Verify the backends
Verify that VM instances are being created in both subnets and create a utility VM to access the backends' HTTP sites.
-
On the Navigation menu, click Compute Engine > VM instances.
Notice the instances that start with instance-group-1 and instance-group-2.These instances are in separate zones, and their internal IP addresses are part of the subnet-a and subnet-b CIDR blocks.
-
Click Create Instance.
-
For the __Machine configuration__page, specify the following, and leave the remaining settings as their defaults:
Property Value (type value or select option as specified) Name utility-vm Region Zone Series E2 Machine type e2-medium (2 vCPU, 4 GB memory) -
Click OS and storage.
-
If the Image shown is not Debian GNU/Linux 12 (bookworm), click Change and select Debian GNU/Linux 12 (bookworm), and then click Select.
-
Click Networking.
-
For Network interfaces, click the dropdown to edit the network interface.
-
Specify the following, and leave the remaining settings as their defaults.
Property Value (type value or select option as specified) Network my-internal-app Subnetwork subnet-a Primary internal IPv4 address Ephemeral (Custom) Custom ephemeral IP address 10.10.20.50 External IPv4 address None -
Click Done.
-
Click Create.
-
Note that the internal IP addresses for the backends are 10.10.20.2 and 10.10.30.2.
Click Check my progress to verify the objective.
-
For utility-vm, click SSH to launch a terminal and connect.
-
If prompted allow SSH-in-browser to connect to VMs, click Authorize.
-
To verify the welcome page for instance-group-1-xxxx, run the following command:
The output should look like this.
Output:
- To verify the welcome page for instance-group-2-xxxx, run the following command:
The output should look like this.
Output:
- Close the SSH terminal to utility-vm:
Task 4. Configure the internal Network Load Balancer
Configure the internal Network Load Balancer to balance traffic between the two backends (instance-group-1 in
Start the configuration
- In the Cloud Console, on the Navigation menu (), click Network services > Load balancing.
- Click Create load balancer.
- For Type of load balancer, select Network Load Balancer (TCP/UDP/SSL), click Next.
- For Proxy or passthrough, select Passthrough load balancer and click Next.
- For Public facing or internal, select Internal and click Next.
- For Create load balance, click Configure.
- For Load balancer name, type
my-ilb
. - For Region, type
. - For Network, select
my-internal-app
from the dropdown.
Configure the regional backend service
The backend service monitors instance groups and prevents them from exceeding configured usage.
-
Click Backend configuration.
-
Specify the following, and leave the remaining settings as their defaults.
Property Value (select option as specified) Instance group instance-group-1 ( ) -
Click Done.
-
Click Add a backend.
-
For Instance group, select instance-group-2 (
). -
Click Done.
-
For Health Check, select Create a health check.
-
Specify the following, and leave the remaining settings as their defaults.
Property Value (select option as specified) Name my-ilb-health-check Protocol TCP Port 80 Check interval 10 sec Timeout 5 sec Healthy threshold 2 Unhealthy threshold 3
- Click Save.
- Verify that there is a blue checkmark next to Backend configuration in the Cloud Console. If there isn't, double-check that you have completed all the steps above.
Configure the frontend
The frontend forwards traffic to the backend.
-
Click Frontend configuration.
-
Specify the following, and leave the remaining settings as their defaults.
Property Value (type value or select option as specified) Subnetwork subnet-b Internal IP purpose > IP address Create IP address -
Specify the following, and leave the remaining settings as their defaults.
Property Value (type value or select option as specified) Name my-ilb-ip Static IP address Let me choose Custom IP address 10.10.30.5 -
Click Reserve.
-
Under Ports, for Port number, type
80
. -
Click Done.
Review and create the internal Network Load Lalancer
- Click Review and finalize.
- Review the Backend and Frontend.
- Click Create.
Wait for the load balancer to be created before moving to the next task.
Click Check my progress to verify the objective.
Task 5. Test the internal Network Load Balancer
Verify that the my-ilb IP address forwards traffic to instance-group-1 in
Access the internal Network Load Balancer
- On the Navigation menu, click Compute Engine > VM instances.
- For utility-vm, click SSH to launch a terminal and connect.
- If prompted allow SSH-in-browser to connect to VMs, click Authorize.
- To verify that the internal Network Load Balancer forwards traffic, run the following command:
The output should look like this.
Output:
- Run the same command a couple of times:
You should be able to see responses from instance-group-1 in
Congratulations!
In this lab, you created two managed instance groups in the
End your lab
When you have completed your lab, click End Lab. Google Cloud Skills Boost removes the resources you’ve used and cleans the account for you.
You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.
The number of stars indicates the following:
- 1 star = Very dissatisfied
- 2 stars = Dissatisfied
- 3 stars = Neutral
- 4 stars = Satisfied
- 5 stars = Very satisfied
You can close the dialog box if you don't want to provide feedback.
For feedback, suggestions, or corrections, please use the Support tab.
Copyright 2022 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.