To add a custom firewall rule in Google Cloud Platform (GCP) to allow access for a specific application or service, such as iPerf, you need to follow a few steps. Firewall rules in GCP are used to control incoming and outgoing network traffic to your virtual machine instances. By adding a custom firewall rule, you can define the necessary criteria to allow or deny traffic to your desired application or service.
Here is a detailed and comprehensive explanation of the process:
1. Open the Google Cloud Console: Start by opening the Google Cloud Console in your web browser and logging in to your GCP account.
2. Navigate to the VPC Network page: In the Cloud Console, navigate to the VPC Network page by selecting "VPC Network" from the left-hand navigation menu. This page provides an overview of your virtual private cloud (VPC) networks and their associated components.
3. Select the network: From the list of VPC networks, choose the network where your virtual machine instances are located. Click on the network name to access its details.
4. Access the Firewall Rules page: Within the selected VPC network details page, click on the "Firewall Rules" tab. This page displays the existing firewall rules for the selected network.
5. Create a new firewall rule: To add a custom firewall rule, click on the "Create Firewall Rule" button. This will open a form where you can define the properties of the new rule.
6. Configure the firewall rule: In the form, provide a name for the firewall rule in the "Name" field. This name should be descriptive and reflect the purpose of the rule, such as "Allow iPerf Access."
7. Specify the source and destination: In the "Source IP ranges" field, enter the IP range or ranges from which you want to allow access. For example, if you want to allow access from any IP address, you can enter "0.0.0.0/0". In the "Destination IP ranges" field, enter the IP range or ranges of the destination instances that will receive the traffic. If you want to allow access to all instances within the network, you can again use "0.0.0.0/0".
8. Define the protocol and port: In the "Protocols and ports" section, select the protocol and port(s) that your application or service uses. For iPerf, which typically uses TCP port 5001, you can enter "tcp:5001" in the "Specified protocols and ports" field. If your application uses multiple ports, you can specify them using a comma-separated list, such as "tcp:5001,udp:1234".
9. Choose the action: Decide whether you want to allow or deny the specified traffic. In most cases, you would choose "Allow" to permit access to the application or service.
10. Save the firewall rule: Once you have configured all the necessary parameters, click on the "Create" button to save the firewall rule. The rule will be applied to the selected VPC network, allowing access to the specified application or service.
It is important to note that the order of firewall rules matters. If you have existing rules that could conflict with the new rule, ensure that the new rule is placed before any conflicting rules in the list. Firewall rules are evaluated in the order they appear, and the first matching rule takes precedence.
To add a custom firewall rule in Google Cloud Platform to allow access for a specific application or service, such as iPerf, you need to navigate to the VPC Network page, select the appropriate network, access the Firewall Rules page, create a new rule, configure the rule with the necessary source, destination, protocol, and port information, choose the action (allow or deny), and save the rule. By following these steps, you can effectively control the network traffic to your desired application or service.
Other recent questions and answers regarding Examination review:
- What are the four components of a firewall rule in Google Cloud, and how do they help control traffic to and from VMs?
- What is the difference between a network-level firewall rule and a per-instance firewall rule in Google Cloud?
- How does Google Cloud Platform's distributed firewalls differ from traditional on-prem firewalls in terms of scalability?
- Why are firewall rules important in the context of cloud computing and the Google Cloud Platform?
More questions and answers:
- Field: Cloud Computing
- Programme: EITC/CL/GCP Google Cloud Platform (go to the certification programme)
- Lesson: GCP networking (go to related lesson)
- Topic: Firewall Rules (go to related topic)
- Examination review

