Other Articles

Compute Engine – Disable IP Forwarding

This check ensures that IP forwarding is disabled on Compute Engine VM instances to prevent unintended packet routing and potential data exposure.

Check Details

  • Resource: Compute Engine VM Instance
  • Check: Disable IP forwarding
  • Risk: Enabling IP forwarding can allow a VM instance to act as a router, which may lead to unintended traffic routing, data leakage, or misuse of network resources.

Remediation via Google Cloud Console

The canIpForward setting can only be configured at instance creation time. To remediate this issue, the affected instance must be deleted and recreated with IP forwarding disabled.


  1. Navigate to the VM Instances page in the Google Cloud Console: https://console.cloud.google.com/compute/instances GCP VM Instances page
  2. Select the VM instance that has IP forwarding enabled.
  3. Click Delete and confirm the deletion. Delete VM instance
  4. On the VM Instances page, click CREATE INSTANCE.
  5. Create a new VM instance with the required configuration. By default, IP forwarding is disabled for new instances.

Remediation via Google Cloud CLI

  1. Open the Google Cloud Console and click the Cloud Shell icon (>_) in the top-right corner. GCP Cloud Shell
  2. Delete the affected VM instance:
    
    gcloud compute instances delete <INSTANCE_NAME>
    
  3. Create a new VM instance to replace it. By default, IP forwarding is disabled:
    
    gcloud compute instances create <NEW_INSTANCE_NAME>
    

Replace <INSTANCE_NAME> and <NEW_INSTANCE_NAME> with the appropriate Compute Engine instance names.

Default Value

By default, Google Cloud Compute Engine VM instances are created with IP forwarding disabled.