Skip to content

Default network exists in a project

Description

The default network has a pre-configured network configuration and automatically generates the following insecure firewall rules:

  • default-allow-internal: Allows ingress connections for all protocols and ports among instances in the network.
  • default-allow-ssh: Allows ingress connections on TCP port 22(SSH) from any source to any instance in the network.
  • default-allow-rdp: Allows ingress connections on TCP port 3389(RDP) from any source to any instance in the network.
  • default-allow-icmp: Allows ingress ICMP traffic from any source to any instance in
    the network.

These automatically created firewall rules do not get audit logged and cannot be configured to enable firewall rule logging. In addition, the default network is an auto mode network, which means that its subnets use the same predefined range of IP addresses. As a result, it is not possible to use Cloud VPN or VPC Network Peering with the default network.

We recommend that a project should not have a default network to prevent use of default network. Based on organization security and networking requirements, the organization should create a new network and delete the default network.

Fix - Runtime

GCP Console

To change the policy using the GCP Console, follow these steps:

  1. Log in to the GCP Console at https://console.cloud.google.com.
  2. Navigate to VPC networks.
  3. Click the network named default.
  4. On the network detail page, click EDIT.
  5. Click DELETE VPC NETWORK.
  6. If needed, create a new network to replace the default network.

CLI Command

For each Google Cloud Platform project:

  1. Delete the default network:
    gcloud compute networks delete default
  2. If needed, create a new network to replace it:
    gcloud compute networks create <network name>

Fix - Buildtime

Terraform

  • Resource: google_project
  • Argument: auto_create_network
resource "google_project" "my_project" {
  name       = "My Project"
  project_id = "your-project-id"
  org_id     = "1234567"
+ auto_create_network   = false
}