Manage global network firewall policies

To control network traffic across your Google Cloud environment, manage global network firewall policies and their rules. This page describes how to list, describe, and update policies and their individual rules. You learn to clone rules between policies and manage policy associations with your Virtual Private Cloud (VPC) networks.

Before you read this page, ensure you are familiar with the concepts described in the Global network firewall policies overview .

Firewall policy tasks

This section describes how to manage global network firewall policies.

Describe a global network firewall policy

You can view details about a global network firewall policy, including the policy rules and the associated rule attributes. All these rule attributes are counted as part of the rule attribute quota. For more information, see "Rule attributes per global network firewall policy" in the Per firewall policy table.

Console

  1. In the Google Cloud console, go to the Firewall policiespage.

    Go to Firewall policies

  2. In the project selector menu, select your project that contains the global network firewall policy.

  3. Click your policy.

gcloud

gcloud compute network-firewall-policies describe POLICY_NAME 
\
    --global

Update a global network firewall policy description

The only policy field that can be updated is the Descriptionfield.

Console

  1. In the Google Cloud console, go to the Firewall policiespage.

    Go to Firewall policies

  2. In the project selector menu, select your project that contains the global network firewall policy.

  3. Click your policy.

  4. Click Edit.

  5. In the Descriptionfield, change the text.

  6. Click Save.

gcloud

gcloud compute network-firewall-policies update POLICY_NAME 
\
    --description DESCRIPTION 
\
    --global

List global network firewall policies

You can view a list of the policies available in your project.

Console

  1. In the Google Cloud console, go to the Firewall policiespage.

    Go to Firewall policies

  2. In the project selector menu, select your project that contains the policy.

    The Network firewall policiessection shows the policies available in your project.

gcloud

gcloud compute network-firewall-policies list --global

Remove the network association

If you need to change the global network firewall policy that's associated with a VPC network, we recommend that you first associate a new policy instead of deleting an existing associated policy. You can associate a new policy in one step, which helps to ensure that a global network firewall policy is always associated with the VPC network.

To delete an association between a global network firewall policy and a VPC network, follow the steps mentioned in this section. Rules in the global network firewall policy don't apply to new connections after its association is deleted.

Console

  1. In the Google Cloud console, go to the Firewall policiespage.

    Go to Firewall policies

  2. In the project selector menu, select your project or the folder that contains the policy.

  3. Click your policy.

  4. Click the Associationstab.

  5. Select the association that you want to delete.

  6. Click Remove association.

gcloud

gcloud compute network-firewall-policies associations delete \
    --firewall-policy FIREWALL_POLICY 
\
    --name ASSOCIATION_NAME 
\
    --firewall-policy-region FIREWALL_POLICY_REGION 
\
    --global-firewall-policy

Delete a global network firewall policy

Before you can delete a global network firewall policy, you must delete all of its associations .

Console

  1. In the Google Cloud console, go to the Firewall policiespage.

    Go to Firewall policies

  2. In the project selector menu, select your project that contains the policy.

  3. Click the policy that you want to delete.

  4. Click the Associationstab.

  5. Select all associations.

  6. Click Remove association.

  7. After all associations are removed, click Delete.

gcloud

Use the following command to delete the policy:

gcloud compute network-firewall-policies delete POLICY_NAME 
\
    --global

Firewall policy rule tasks

This section describes how to manage global network firewall policy rules.

Clone rules from one policy to another

Cloning copies the rules from a source policy to a target policy, replacing all existing rules in the target policy.

Console

  1. In the Google Cloud console, go to the Firewall policiespage.

    Go to Firewall policies

  2. In the project selector menu, select your project that contains the policy.

  3. Click the policy from which you want to copy the rules.

  4. Click Cloneat the top of the screen.

  5. Provide the name of a target policy.

  6. If you want to associate the new policy immediately, click Continue  > Associate.

  7. In the Associate policy with VPC networkspage, select the networks and click Associate.

  8. Click Continue.

  9. Click Clone.

gcloud

gcloud compute network-firewall-policies clone-rules TARGET_POLICY 
\
    --global \
    --source-firewall-policy SOURCE_POLICY 

Replace the following:

  • TARGET_POLICY : the name of the target policy.
  • SOURCE_POLICY : the URL of the source policy.

Describe a rule

You can view details about a specific rule in a global network firewall policy.

Console

  1. In the Google Cloud console, go to the Firewall policiespage.

    Go to Firewall policies

  2. In the project selector menu, select your project that contains the policy.

  3. Click your policy.

  4. Click the priority of the rule.

gcloud

gcloud compute network-firewall-policies rules describe PRIORITY 
\
    --firewall-policy= POLICY_NAME 
\
    --global-firewall-policy

Replace the following:

  • PRIORITY : the priority number that uniquely identifies the rule.
  • POLICY_NAME : the name of the policy that contains the rule.

Update a global network firewall policy rule

You can modify a global network firewall policy rule to change rule attributes, such as action on match, IP address ranges, or protocols and ports.

Console

  1. In the Google Cloud console, go to the Firewall policiespage.

    Go to Firewall policies

  2. In the project selector menu, select your project that contains the global network firewall policy.

  3. Click the name of the global network firewall policy that contains the rule to update.

  4. Click the priority of the rule.

  5. Click Edit.

  6. Modify the firewall rule fields that you want to change. For descriptions about each field, see one of the following:

  7. Click Save.

gcloud

gcloud compute network-firewall-policies rules update PRIORITY 
\
    --firewall-policy= POLICY_NAME 
\
    --global-firewall-policy \
    [...other flags that you want to modify...]

Replace the following:

  • PRIORITY : the priority number that uniquely identifies the rule.
  • POLICY_NAME : the name of the policy that contains the rule.

Supply the flags that you want to modify. For flag descriptions, see one of the following:

View effective firewall rules for a VM interface

You can view all firewall rules—from all applicable firewall policies and VPC firewall rules—that apply to a network interface of a Compute Engine VM.

Console

  1. In the Google Cloud console, go to the VM instancespage.

    Go to VM instances

  2. In the project selector menu, select the project that contains the VM.

  3. Click the VM.

  4. For Network interfaces, click the name of the interface.

  5. In Network configuration analysissection, click the Firewallstab.

  6. To view the effective firewall rules, click Firewall rule viewtab.

gcloud

gcloud compute instances network-interfaces get-effective-firewalls INSTANCE_NAME 
\
    [--network-interface INTERFACE 
] \
    [--zone ZONE 
]

Replace the following:

  • INSTANCE_NAME : the VM for which you want to view the effective rules; if no interface is specified, the command returns rules for the primary interface ( nic0 ).
  • INTERFACE : the VM interface for which you want to view the effective rules; the default value is nic0 .
  • ZONE : the zone of the VM; this line is optional if the chosen zone is already set as the default.

View an effective firewall rules for a network

You can view all hierarchical firewall policy rules, VPC firewall rules, and global network firewall policy rules that apply to all regions of a VPC network.

Console

  1. In the Google Cloud console, go to the VPC networkspage.

    Go to VPC networks

  2. Click the network you want to view firewall policy rules for.

  3. On the VPC network detailspage, click Firewallstab.

  4. To view the rules that apply to this network, click Firewall rule viewtab.

gcloud

gcloud compute networks get-effective-firewalls NETWORK_NAME 

Replace NETWORK_NAME with the network for which you want to view the effective rules.

You can also view effective firewall rules for a network from the Firewallpage.

Console

  1. In the Google Cloud console, go to the Firewall policiespage.

    Go to Firewall policies

  2. The firewall policies are listed in the Firewall policies inherited by this projectsection.

  3. Click each firewall policy to view the rules that apply to this network.

Delete a rule from a policy

Deleting a rule from a policy causes the rule to no longer apply to new connections to or from the rule's target.

Console

  1. In the Google Cloud console, go to the Firewall policiespage.

    Go to Firewall policies

  2. In the project selector menu, select your project that contains the policy.

  3. Click your policy.

  4. Select the rule that you want to delete.

  5. Click Delete.

gcloud

gcloud compute network-firewall-policies rules delete PRIORITY 
\
    --firewall-policy= POLICY_NAME 
\
    --global-firewall-policy

Replace the following:

  • PRIORITY : the priority number that uniquely identifies the rule.
  • POLICY_NAME : the name of the policy that contains the rule.

What's next

Design a Mobile Site
View Site in Mobile | Classic
Share by: