Create the firewall rule

Check my progress

/ 100

This lab may incorporate AI tools to support your learning.
This content is not yet optimized for mobile devices.
For the best experience, please visit us on a desktop computer using a link sent by email.

GSP045

Google Cloud self-paced labs

Overview

In this hands-on lab, you read through real-world scenarios, recreate the environments, and work on improving the performance of troubled networks.

You compare the different instances to each other, just like the troubleshooting use case, so you can prove the results and become familiar with the steps used to improve your own systems' performance.

This lab adapts blog posts by Colt McAnlis: Core Count and the Egress problem and Internal IP vs External IP. Colt blogs about Google Cloud network performance on Medium.

What you'll learn

In this lab, you learn how to perform the following tasks:

  • Test network connectivity and performance using open source tools.
  • Inspect network traffic using open source tools.
  • Evaluate how machine core count and virtual CPU sizing affect network throughput.

Prerequisites

  • Basic knowledge of Google Cloud services (best obtained by completing the labs in Google Cloud Essentials)
  • Basic Google Cloud networking and TCP/IP knowledge (best obtained by completing the earlier labs in the Networking in the Google Cloud course)
  • Basic Unix/Linux command-line knowledge

Setup and requirements

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.

This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito (recommended) or private browser window to run this lab. This prevents conflicts between your personal account and the student account, which may cause extra charges incurred to your personal account.
  • Time to complete the lab—remember, once you start, you cannot pause a lab.
Note: Use only the student account for this lab. If you use a different Google Cloud account, you may incur charges to that account.

How to start your lab and sign in to the Google Cloud console

  1. Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the right is the Lab setup and access panel with the following:

    • The Open Google Cloud console button
    • The temporary credentials (username and password) that you must use for this lab
    • Other information, if needed, to step through this lab

    Note that the lab timer is located near the top of the page, showing the remaining time.

  2. Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).

    The lab spins up resources, and then opens another tab that shows the Sign in page.

    Tip: Arrange the tabs in separate windows, side-by-side.

    Note: If you see the Choose an account dialog, click Use Another Account.
  3. If necessary, copy the Username below and paste it into the Sign in dialog.

    {{{user_0.username | "Username"}}}

    You can also find the Username in the Lab setup and access panel.

  4. Click Next.

  5. Copy the Password below and paste it into the Welcome dialog.

    {{{user_0.password | "Password"}}}

    You can also find the Password in the Lab setup and access panel.

  6. Click Next.

    Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges.
  7. Click through the subsequent pages:

    • Accept the terms and conditions.
    • Do not add recovery options or two-factor authentication (because this is a temporary account).
    • Do not sign up for free trials.

After a few moments, the Google Cloud console opens in this tab.

Note: To access Google Cloud products and services, click the Navigation menu or type the service or product name in the Search field. Navigation menu icon and Search field

The goal of this lab is to show you the relationship between core size and throughput, so the lab preconfigures six instances when you start the lab.

  • In the Google Cloud console, on the Navigation menu (☰), select Compute Engine > VM instances to view your instances:

The VM instances page listing six instances and their details in table format

Note: Your instance region and zone may differ from the ones shown in the screenshot.

Run a connection test

Run a quick connection test to make sure things are working well.

  1. In the console, for instance-1, click SSH.

  2. In the SSH terminal, run the following command to ping instance-2 (replace <external ip address of instance-2> with the external IP address of instance-2):

ping -c 5

Example output:

student-00-aafd1bd9c185@instance-1:~$ ping -c 5 35.194.158.169 PING 35.194.158.169 (35.194.158.169) 56(84) bytes of data. 64 bytes from 35.194.158.169: icmp_seq=1 ttl=76 time=1.89 ms 64 bytes from 35.194.158.169: icmp_seq=2 ttl=76 time=0.409 ms 64 bytes from 35.194.158.169: icmp_seq=3 ttl=76 time=0.542 ms 64 bytes from 35.194.158.169: icmp_seq=4 ttl=76 time=0.557 ms 64 bytes from 35.194.158.169: icmp_seq=5 ttl=76 time=0.559 ms --- 35.194.158.169 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4001ms rtt min/avg/max/mdev = 0.409/0.792/1.894/0.554 ms
  1. In the SSH terminal, run the following command to ping instance-3 (replace <external ip address of instance-3> with the external IP address of instance-3):
ping -c 5

Example output:

student-00-aafd1bd9c185@instance-1:~$ ping -c 5 35.194.187.75 PING 35.194.187.75 (35.194.187.75) 56(84) bytes of data. 64 bytes from 35.194.187.75: icmp_seq=1 ttl=64 time=1.59 ms 64 bytes from 35.194.187.75: icmp_seq=2 ttl=64 time=0.336 ms 64 bytes from 35.194.187.75: icmp_seq=3 ttl=64 time=0.338 ms 64 bytes from 35.194.187.75: icmp_seq=4 ttl=64 time=0.302 ms 64 bytes from 35.194.187.75: icmp_seq=5 ttl=64 time=0.270 ms --- 35.194.187.75 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3999ms rtt min/avg/max/mdev = 0.270/0.568/1.596/0.514 ms

Everything looks good, so continue to the next section.

Review firewall rules

This lab also includes preconfigured firewall rules.

  • To view existing firewall rules, on the Navigation menu (☰), select VPC network > Firewall, and then click iperftesting.

The iperftesting firewall rule uses the following configuration:

Field Value Comments
Name iperftesting New rule name
Targets All instances in the network
Source IP ranges 0.0.0.0/0 Opens the firewall for any IP address from the internet.
Protocols and ports tcp:5001; udp:5001
Direction of traffic Ingress
Action on match Allow

Now you're ready to start using the lab.

Use case 1: Networking and Compute Engine core count

In this first scenario, you see how the size of the machines you use affects measurable throughput.

Dobermanifesto is a video microblogging network exclusively for pets. Users worldwide can upload animal-based videos and send them anywhere for others to view and experience.

While transferring data to and from their Compute Engine backends, the company observed lower bandwidth than expected:

The line graph: Dobermanifesto same-zone throughput, measured in Gbits per second.

Task 1. Reproduce the behavior

To reproduce this behavior, engineers created two instances in the same zone and ran iperf between them 100 times.

The line graph: Same zone transfer times 100, measured in Mbits per second

This performance is even worse! Obviously something was wrong with the test. You need more information and a deeper set of reproduction steps from the company.

Now you set up the scenario.

Test throughput in Dobermanifesto's environment

  1. Return to the VM instances page in the Google Cloud console.

  2. For instance-1 (1vCPU 3.75GB), click SSH, and then run the following command to start an iperf server:

iperf -s
  1. For instance-2 (1vCPU 3.75GB), click SSH, and then run the following command to generate iperf traffic to instance-1 (replace <external ip address of instance-1> with the external IP address of instance-1):
iperf -c

Example output:

student-00-aafd1bd9c185@instance-2:~$ iperf -c 35.225.180.44 ------------------------------------------------------------ Client connecting to 35.225.180.44, TCP port 5001 TCP window size: 45.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.20.0.4 port 56330 connected with 35.225.180.44 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0000-10.0010 sec 4.66 GBytes 4.00 Gbits/sec
  1. Return to the instance-1 SSH terminal, and then press CTRL+C to stop the iperf server.

Test throughput on e2-micro instances

  1. In the console, for instance-6 (1vCPU e2-micro .6GB), click SSH.

  2. Run the following command to start an iperf server:

iperf -s

Example output:

student-00-aafd1bd9c185@instance-6:~$ iperf -s ------------------------------------------------------------ Server listening on TCP port 5001 TCP window size: 128 KByte (default) ------------------------------------------------------------
  1. In the instance-2 SSH terminal, run the following command to test the connection to instance-6 (replace <internal ip address of instance-6> with the internal IP address of instance-6):
iperf -c

Example output:

student-00-aafd1bd9c185@instance-2:~$ iperf -c 10.40.0.7 ------------------------------------------------------------ Client connecting to 10.40.0.7, TCP port 5001 TCP window size: 45.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.40.0.5 port 54029 connected with 10.40.0.7 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 2.29 GBytes 1.96 Gbits/sec
  1. Return to the instance-6 SSH terminal, and then press CTRL+C to stop the iperf server.

What happened? Bandwidth appears to have gone up. It may have in your case as well, or it may have been less.

In the next section, you see how total core count constrains bandwidth, and that with a core count of 1, bandwidth never exceeds 2 Gbits/sec or so. As a result, the network speed is slow and bandwidth-constrained, similar to what Dobermanifesto experienced. When you test with 4-vCPU machines next, you see higher throughput.

Correlate core count to throughput

Why weren't the results much different? The Compute Engine network bandwidth documentation states:

Outbound or egress traffic from a virtual machine is subject to maximum network egress throughput caps. These caps are dependent on the number of vCPUs that a virtual machine instance has. Each core is subject to a 2 Gbits/second (Gbps) cap for peak performance. Each additional core increases the network cap, up to a theoretical maximum of 16 Gbps for each virtual machine.

This means that the more virtual CPUs in your network, the more networking throughput you get.

To evaluate what this looks like in practice, engineers set up different core size groups in the same zone and ran iperf between them 1,000 times.

The bar chart: RCP Throughput by instance type, times 1000, displaying the difference between average and maximum.

As the core count goes up, so does the average and maximum throughput. Even with this simple test, you can see that hard 16 Gbps limit on the larger machines.

Note: If you run iperf with multiple threads (~8 or so), you can exceed 10 Gbps and reach about 16 Gbps using an e2-standard-16 or larger machine. This lab environment does not include a machine of that size, so you run a test with multiple threads on a 4-vCPU machine next. There are also higher-cost VMs in the N2, N2D, C2, or C2D series that allow you to select a high-bandwidth Tier 1 configuration and reach 50–100 Gbps.

Task 2. Improve network performance

The Dobermanifesto network uses 1-vCPU machines. Increasing the core count helps Dobermanifesto achieve better results. Now you test this theory.

  1. In the console, for instance-3 (4vCPU 15GB memory), click SSH, and then run the following command to start an iperf server:
iperf -s

Example output:

student-00-aafd1bd9c185@instance-3:~$ iperf -s ------------------------------------------------------------ Server listening on TCP port 5001 TCP window size: 128 KByte (default) ------------------------------------------------------------
  1. For instance-4 (4vCPU 15GB memory), click SSH, and then run the following command to test the connection to instance-3 (replace <internal ip address of instance-3> with the internal IP address of instance-3):
iperf -c

Example output:

student-00-aafd1bd9c185@instance-4:~$ iperf -c 10.40.0.2 ------------------------------------------------------------ Client connecting to 10.40.0.2, TCP port 5001 TCP window size: 45.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.40.0.4 port 54081 connected with 10.40.0.2 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 8.93 GBytes 7.67 Gbits/sec
  1. In the instance-4 SSH terminal, run the following command to test with 4 parallel threads (replace <internal ip address of instance-3> with the internal IP address of instance-3):
iperf -c -P4
  1. In the instance-4 SSH terminal, run the following command to test with 8 parallel threads (replace <internal ip address of instance-3> with the internal IP address of instance-3):
iperf -c -P8
  1. Return to the instance-3 SSH terminal, and then press CTRL+C to stop the iperf server.

In these experiments, both the server and client use 4 vCPUs, which greatly increases the speed. The transfer rate increases by 6.64 GBytes, and the bandwidth increases by 5.71 Gbits/sec. With multiple threads, the performance reaches the cap for that core count.

  1. Continue testing with instance-5, which is a higher-performance 4-vCPU machine of instance type highcpu-4.

This instance type has faster CPUs, but less memory. What differences do you see, if any, when testing with multiple threads?

Now the Dobermanifesto team needs to decide what route to take. After profiling their CPU usage and reviewing the Compute Engine pricing, they chose an e2-standard-4 machine, which gave them almost 4x the average throughput at a lower cost than e2-standard-8 machines.

One of the nice things about moving to the larger machine is that it actually runs less frequently. It turns out that their machines were spending a lot of time staying awake just to transfer data. With the new machine size, their instances had more downtime, allowing the load balancer to reduce the total number of instances on a daily basis. So on one hand, they paid for a higher-grade machine, but on the other hand, they use fewer core-hours on a monthly basis.

Once your performance directly impacts the bottom line, there are many nuanced tradeoffs to consider.

Use case 2: Google Cloud networking with internal IPs

In this next example, you use iperf to test throughput speed. You set up one machine as the server, point other machines to it, and compare the results.

Gecko Protocol, a B2B company offering a custom, lightweight networking protocol built for gaming and other real-time graphics systems, observed lower-than-expected throughput on its backend machines that transfer and transcode large video and graphics files.

Here are the results of their baseline iperf test:

------------------------------------------------------------ Client connecting to 104.155.145.79, TCP port 5001 TCP window size: 45.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.128.0.3 port 53504 connected with 104.155.145.79 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 1.03 GBytes 884 Mbits/sec

When duplicating the test, the network setup was identical, but the test results were quite different:

student-00-aafd1bd9c185@instance-2:~$ iperf -c 10.128.0.2 ------------------------------------------------------------ Client connecting to 10.128.0.2, TCP port 5001 TCP window size: 45.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.128.0.3 port 38978 connected with 10.128.0.2 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 2.27 GBytes 1.95 Gbits/sec

1.95 Gbits/sec was much higher than what Gecko Protocol saw in their graphs. So what's going on?

Now recreate this scenario.

  1. In the console, for instance-1, click SSH, and then run the following command to start an iperf server:
iperf -s

Example output:

student-00-aafd1bd9c185@instance-1:~$ iperf -s ------------------------------------------------------------ Server listening on TCP port 5001 TCP window size: 128 KByte (default) ------------------------------------------------------------
  1. In the console, for instance-2, click SSH, and then run the following command to test the connection using the external IP address (replace <external ip address of instance-1> with the external IP address of instance-1):
iperf -c

Example output:

student-00-aafd1bd9c185@instance-2:~$ iperf -c 35.201.145.135 ------------------------------------------------------------ Client connecting to 35.201.145.135, TCP port 5001 TCP window size: 45.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.40.0.8 port 58691 connected with 35.201.145.135 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 1.36 GBytes 1.16 Gbits/sec

Further discussion with Gecko Protocol revealed that they used external IPs to connect their machines, whereas the test used internal IPs. When the machines are in the same network, connecting them with internal IPs results in faster throughput.

  1. In the instance-2 SSH terminal, run the following command to test the connection using the internal IP address (replace <internal ip address of instance-1> with the internal IP address of instance-1):
iperf -c

Example output:

student-00-aafd1bd9c185@instance-2:~$ iperf -c 10.40.0.5 ------------------------------------------------------------ Client connecting to 10.40.0.5, TCP port 5001 TCP window size: 45.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.40.0.8 port 42950 connected with 10.40.0.5 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 2.26 GBytes 1.94 Gbits/sec

Look at the two different Transfer and Bandwidth rates. In this example, changing to the internal IP address resulted in a 0.9 GBytes improvement in transfer rate, and a 0.78 Gbits/sec improvement in bandwidth. You just proved that the internal connection is faster.

Building on what you learned from solving the Dobermanifesto problem, can using a larger machine improve the network speed even more? instance-2 has only 1 vCPU. How fast is the connection if the machine is a little larger, or a lot larger? Continue to test using the internal IP address (and test the external IP address as well if you have time).

Test with a 4-vCPU machine

  • For instance-3, click SSH, and then run the following command to test the connection using the internal IP address (replace <internal ip address of instance-1> with the internal IP address of instance-1):
iperf -c

Example output (your results may differ):

student-00-aafd1bd9c185@instance-3:~$ iperf -c 10.40.0.5 ------------------------------------------------------------ Client connecting to 10.40.0.5, TCP port 5001 TCP window size: 45.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.40.0.6 port 39115 connected with 10.40.0.5 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 4.53 GBytes 3.89 Gbits/sec

Test with a high-CPU machine

  • For instance-5, click SSH, and then run the following command to test the connection using the internal IP address (replace <internal ip address of instance-1> with the internal IP address of instance-1):
iperf -c

Example output:

student-00-aafd1bd9c185@instance-5:~$ iperf -c 10.40.0.5 ------------------------------------------------------------ Client connecting to 10.40.0.5, TCP port 5001 TCP window size: 45.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.40.0.3 port 39736 connected with 10.40.0.5 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 10.3 GBytes 8.84 Gbits/sec

This really improves the throughput rate.

Gecko Protocol also needs to consider which core size works best. This small debugging session improved their video and graphics data transfer by ~14x, which is a significant gain because their offering relies on high-performance backend services.

Task 3. Test in your own environment

This lab doesn't cover how to test your own system, but here's additional information to take back with you. For more information on testing your own network, read Network Throughput Testing with iPerf.

If you have time and want to set up a VM to test, feel free. When you create your VMs, make sure to use the iperftest firewall rule and tag. Test both your internal and external IP addresses.

Configure firewall settings for network speed tests

  1. In the Google Cloud console, on the Navigation menu (☰), select VPC network > Firewall.

  2. Click Create firewall rule. Use the following configuration to create a firewall rule:

Field Value Comments
Name iperf-testing New rule name
Targets All instances in the network
Source IP ranges 0.0.0.0/0 Opens the firewall for any IP address from the internet.
Direction of traffic Ingress
Action on match Allow
Protocols and ports tcp:5001; udp:5001
  1. Click Create.

Click Check my progress to verify the objective. Create the firewall rule

The tendency is to get the workload as close to 100% as possible, which leaves little space for the disk to defragment.

Usage at 90–93% is healthy, but at 98% usage, performance drops because of high contention.

When you test, if I/O performance decays, check the throttle counters. If the counters show no throttling, check CPU usage. If CPU usage is high, that is the source of the problem.

Task 4. Explore additional resources

In the lab interface, the Student Resources panel includes links to videos related to this lab.

Student Resources section with links to Compute Engine and the Egress Problem, and Internal IP vs External IP Performance

Congratulations!

Congratulations! In this lab, you learned how to test network connectivity and performance using open source tools, and how the size of your machine can affect the performance of your network.

Next steps / learn more

Google Cloud training and certification

...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.

Manual Last Updated November 10, 2026

Lab Last Tested October 30, 2026

Copyright 2026 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.

Before you begin

  1. Labs create a Google Cloud project and resources for a fixed time
  2. Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
  3. On the top left of your screen, click Start lab to begin

Use private browsing

  1. Copy the provided Username and Password for the lab
  2. Click Open console in private mode

Sign in to the Console

  1. Sign in using your lab credentials. Using other credentials might cause errors or incur charges.
  2. Accept the terms, and skip the recovery resource page
  3. Don't click End lab unless you've finished the lab or want to restart it, as it will clear your work and remove the project

This content is not currently available

We can notify you via email when it becomes available

Great!

We can contact you via email if it becomes available

One lab at a time

Confirm to end all existing labs and start this one

Use private browsing to run the lab

Using an Incognito or private browser window is the best way to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.