Networking interview question · Most asked
How do you connect many VPCs together, and why isn't VPC peering always enough?
Summary
Peering connects exactly two VPCs and isn't transitive, so a full mesh grows quadratically and is hard to segment. A hub such as AWS Transit Gateway (Azure Virtual WAN or hub VNet, Google Cloud Network Connectivity Center) lets every VPC attach once, with route tables for segmentation and central links to on-premises.
Longer Answer
Peering is still good for a few high-bandwidth pairs (no hourly attachment or data-processing charges on the hub). All options require non-overlapping CIDRs. Shared VPC models (Google Cloud Shared VPC, AWS VPC sharing) avoid connectivity altogether by letting several projects/accounts use one network.
Key Points
- Peering: 1-to-1, non-transitive.
- Mesh = n(n-1)/2 connections.
- Transit hub with route-table segmentation.
- No overlapping ranges anywhere.
Deep dive: Networking Tutorial: Connecting Networks
Explanation
What interviewers look for
Scaling, segmentation and cost trade-offs.
More most-asked Networking questions
- How does NAT work, and what are its limits?
- What's the difference between TCP and UDP, and when would you choose UDP?
- What do 502, 503 and 504 errors from a load balancer usually mean?
- What is CIDR notation? How many usable addresses are in a /26, and in an AWS /26 subnet?
- How does DNS resolution work, and what does a record's TTL control?
- What does TLS provide, and how does certificate validation work?
- What happens, at the network level, when you type a URL into a browser and press Enter?
- What's the difference between stateful and stateless firewalls? Give cloud examples.