---
title: Instances should have IP forwarding disabled
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > OOTB Rules > Instances should have IP forwarding
  disabled
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Instances should have IP forwarding disabled
 
## Description{% #description %}

Keep IP forwarding disabled on Compute Engine instances that are not meant to route traffic. With `canIpForward` enabled, an instance can send and receive packets whose source or destination IP address does not match its own, which can be used to bypass network controls. This rule fails when `canIpForward` is true. GKE nodes are skipped because GKE requires IP forwarding on them. An instance counts as a GKE node when its name starts with `gke-` and it has a non-empty `goog-k8s-cluster-name` label, which GKE applies to node VMs.

## Remediation{% #remediation %}

Update the existing instance's `canIpForward` property to `false`. The update only requires a refresh, so the instance does not need to stop or restart.

1. Export the instance configuration:

   ```shell
   gcloud compute instances export INSTANCE_NAME --zone ZONE --destination FILE_PATH
   ```

1. In the exported file, change `canIpForward: true` to `canIpForward: false`.

1. Apply the change:

   ```shell
   gcloud compute instances update-from-file INSTANCE_NAME --zone ZONE --source FILE_PATH --most-disruptive-allowed-action REFRESH
   ```

For more information, see [Enable IP forwarding for instances](https://docs.cloud.google.com/vpc/docs/using-routes#canipforward) and [Update instance properties](https://docs.cloud.google.com/compute/docs/instances/update-instance-properties).

## References{% #references %}

- [Enable IP forwarding for instances](https://docs.cloud.google.com/vpc/docs/using-routes#canipforward)
- [Update instance properties](https://docs.cloud.google.com/compute/docs/instances/update-instance-properties)
- [Automatically applied labels](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/creating-managing-labels#automatically-applied-labels)
- [CIS Google Cloud Platform Foundation Benchmark](https://www.cisecurity.org/benchmark/google_cloud_computing_platform)
