Menu ⌃

VPCs & subnets

A VPC is a private network for your VMs. Each VPC holds one or more subnets — private IPv4 ranges — and every VM gets a stable private address in a subnet. A default VPC is created with your first VM; create your own to choose address ranges and keep environments apart.

How it fits together

  • VPC — an isolation boundary inside a project. VMs in different VPCs don't share a private network.
  • Subnet — a private IPv4 range in a VPC. Ranges must be RFC1918 (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16). Subnets in the same VPC can't overlap; separate VPCs may reuse the same range.
  • Region — a subnet is enabled in a datacenter before VMs there can use it. The dashboard handles this when you add a subnet in a region.
  • VM address — each VM gets a private IPv4 from its subnet that persists across stop/start, restart, and resize.

The default VPC

If you just create a VM, you don't need to set anything up: your first VM creates a default VPC and default subnet in its region, and later VMs join it. That first launch takes a little longer while the network is prepared.

Create a VPC

Networking → VPCs, then create a VPC with a name. Open it and Add subnet: pick the region and a private IPv4 range. A new VPC has no subnets, so VMs can't use it until you add one.

Custom DNS

By default, VMs use Metalhost's private DNS. When you add a subnet you can instead list up to three IPv4 resolvers, in order of preference. The choice is fixed at creation and isn't pushed to existing guests. A custom resolver must answer private names itself if you rely on them.

Put a VM in a subnet

On the VM create page, pick the private subnet in the networking section. Only subnets that are ready in the selected region are offered. See Create a VM.

VM-to-VM traffic

VMs in the same VPC reach each other over their private addresses. To restrict that — say, only your app tier may reach your database on 5432 — use security groups.

Reaching the internet

  • Outbound — VMs reach the internet through their public IPv4 or, without one, through shared NAT. Shared NAT addresses aren't stable and shouldn't be used in allowlists. Turn outbound off per VM under VM → networking → Internet access.
  • Public IPv4 — reserve an address and map it to a VM's private IPv4. See Public IPs.
  • Public IPv6 — each VM gets its own routed IPv6 /64. See Public IPv6.
  • Load balancers — one public IPv4 in front of several VMs in a subnet. See Load balancers.
  • Inbound is denied until you add firewall rules.

Delete a VPC

Remove the VMs, disks, addresses, load balancers, and file shares that use a VPC first — deleting a VPC never deletes them. Then remove the VPC from each region (Remove region), delete its subnets, and delete the VPC.

What's next