GCP Instances and Firewalling

Creating a Firewall rule

GCP instances have a default interface card assigned to them nic0

Select the interface and then select Firewall

Here you can create your firewall rules, specifying where the rule will be applied (the target column)

In the “Create Firewall Rule” section you can specify the target of the rule

Network - the VPC this will be applied to

Target tags - the VMs within the network that this rule is applied to

Source IPv4 range - where in the outside network will connections be allowed to come from

Protocols and Ports - which ports to expose

Once completed select CREATE

Your rule will now be in the firewall table

 

Assigning the firewall rule to a VM instance

Scroll down and locate “Network Tags” and select “EDIT” from the menu bar above

Enter the Target Tag value you defined when you created the firewall

Now SAVE your changes

 

The exposed port should now be available on the VM’s IP address.