AWS, Azure & GCP · Cloud across providers

How do virtual networks work?

MediumvpcnetworkingcidrUpdated Oct 2026
Quiz this track

Short answer

A virtual network is a logically isolated IP address space you define, subdivided into subnets and connected to other networks through gateways, peering or private endpoints. It controls addressing, routing and segmentation.

A VPC or VNet is a private address space inside a provider region. You choose a CIDR block, carve it into subnets, attach route tables, and decide which gateways or endpoints can reach it. Resources outside the network cannot route to it unless you explicitly connect them.

hcl
resource "aws_vpc" "main" {
  cidr_block           = "10.0.0.0/16"
  enable_dns_support   = true
  enable_dns_hostnames = true
}

resource "aws_subnet" "public_a" {
  vpc_id            = aws_vpc.main.id
  cidr_block        = "10.0.1.0/24"
  availability_zone = "ap-south-1a"
}
A VPC and one subnet, with DNS enabled for service discovery.

Core building blocks

  • CIDR block: the overall private range, sized with future growth in mind
  • Subnets: smaller ranges in one AZ, usually split into public, private and isolated tiers
  • Route tables: decide where traffic for each destination goes
  • Gateways and endpoints: internet gateway, NAT, VPN, peering, private link or transit gateway
  • Security controls: security groups, network ACLs, firewall policies and flow logs

Plan address space before you build. Overlapping CIDRs across VPCs, acquisitions or on-premises networks make peering and hybrid connectivity painful, and renumbering a live network is a major project.

A VPC is regional, not global. Multi-region designs need a separate network per region plus deliberate connectivity between them.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1How would you size a CIDR block for a growing platform?
  2. 2What is the difference between an internet gateway and a NAT gateway?
  3. 3Why are overlapping CIDRs a problem?
  4. 4When would you use a private endpoint instead of a NAT gateway?

Say it in the interview

A virtual network is an isolated address space that I define with a CIDR block, then split into subnets across availability zones. Route tables and gateways decide what can reach it, and security groups and ACLs control traffic. I plan the address space early because overlapping ranges make peering and hybrid connectivity expensive to fix later.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live AWS, Azure & GCP mock interview and get scored feedback on depth, clarity and confidence.