Legacy networks are not recommended. Many newer Google Cloud features are not supported in legacy networks. Instead, use Virtual Private Cloud (VPC) networks. For more information, see the VPC Network Overview.
This page describes creating and modifying Google Cloud Platform (GCP) legacy networks. Use this page only if you have an existing setup that requires a legacy network.
Legacy networks do not support the following Google Cloud features. To use these features, you must use VPC networks instead.
- VPC subnets
- Alias IP
- Multiple Network Interfaces
- Shared VPC
- VPC Peering
- Cloud NAT
- All Private Access Options for Services
You cannot convert a legacy network into a VPC network. If you need the features of a VPC network, you have to rebuild your configuration in a VPC network, migrate or recreate your VMs, then point DNS or your services at the new setup.
Migrating VMs out of a legacy network
You can migrate your virtual machine (VM) instances out of your legacy network to a VPC network. For instructions, see Migrating a VM between networks.
Creating a legacy network
You can still create a legacy network, though it is not recommended. Legacy networks have a single global IP range. You cannot create subnets in a legacy network or convert a legacy network to a VPC network.
Create a new legacy network in your project.
gcloud compute networks create legacy-network1 \ --subnet-mode legacy \ --range 10.240.0.0/16
Created [https://www.googleapis.com/compute/latest/projects/PROJECT_ID/global/networks/legacy-network1]. NAME MODE IPV4_RANGE GATEWAY_IPV4 legacy-network1 legacy 10.240.0.0/16 10.240.0.1
Deleting a legacy network
For a legacy network, you can explicitly delete the network only if the network is not in use by any resources.
To delete the network:
gcloud compute networks delete my-legacy-network