---
title: "Cloud networking explained: VPCs, subnets, gateways and CDNs · CloudSat"
description: "Cloud networking explained: VPCs, subnets, route tables, NAT, security groups, load balancers and CDNs, and how to get the same isolation on VPS servers."
url: https://cloudsat.io/learn/cloud-networking-building-blocks
updated: 2026-11-18T12:00:00Z
source: CloudSat (https://cloudsat.io/). Prices in USD.
---

[Networking](https://cloudsat.io/learn/topic/networking-and-dns)

# Cloud networking explained: VPCs, subnets, gateways and CDNs

Cloud networking explained: VPCs, subnets, route tables, NAT, security groups, load balancers and CDNs, and how to get the same isolation on VPS servers.

CloudSat team November 18, 2026 7 min read

A cloud console shows a dozen networking objects before you have deployed a single server: VPCs, subnets, route tables, gateways, security groups. None of them is new. Each is a piece of a physical network (a switch, a router, a firewall, a NAT box) rebuilt in software. Learn the map once and every provider's console reads the same. And on providers that give each server a public address instead of a private network, you can build the same isolation yourself.

## The objects, mapped to a physical network

| Cloud object | Physical equivalent | What it decides |
| --- | --- | --- |
| VPC or virtual network | Your own private network | The address range your servers share, isolated from other customers |
| Subnet | A network segment | Which servers sit together, and whether they are public or private |
| Route table | A router's routing table | Where traffic for each destination goes next |
| Internet gateway | Your internet connection | Whether a subnet can reach the internet and be reached from it |
| NAT gateway | A home router doing NAT | Outbound internet for private servers, with no inbound path |
| Security group | A stateful firewall in front of each server | Which ports each server accepts, and from whom |
| Network ACL | A stateless filter at the segment edge | Coarse allow and deny rules for a whole subnet |
| Load balancer | A load-balancing appliance | How traffic spreads across servers, and which are healthy |
| CDN | Caches close to your users | Static files and TLS served near visitors |
| Peering or VPN gateway | A leased line or site-to-site VPN | Private links between networks |
| Private DNS zone | An internal DNS server | Names that resolve to private addresses, only inside the network |

Names differ between providers. The jobs do not. When a console offers an object you do not recognize, ask which physical box it replaces, and its settings usually make sense.

## Plan addresses you will not regret

Addresses inside a private network come from the blocks RFC 1918 reserves: 192.168.0.0/16, 172.16.0.0/12 or 10.0.0.0/8, smallest to largest. Three habits save pain later:

- **Avoid 192.168.0.0/24 and 192.168.1.0/24.** Home routers use them. When someone connects over a VPN from home, the overlap breaks routing in ways that are tedious to debug.
- **Give each environment its own block**, such as 10.10.0.0/16 for production and 10.20.0.0/16 for staging, with /24 subnets inside. Networks that may be linked later must never overlap.
- **Leave 100.64.0.0/10 alone.** It is shared address space for carrier-grade NAT, and some mesh VPN tools use it too.

IPv6 changes the picture. Servers usually get globally routable addresses, there is no NAT to hide behind, and isolation comes entirely from firewall rules. That is not weaker, just explicit: with a default-deny firewall, nothing is reachable unless a rule allows it.

## Public and private subnets

The classic layout puts only the front door on the internet:

```text
                 Internet
                    |
              [ CDN edge ]              caches static files, terminates TLS near users
                    |
   +--------------- VPC 10.10.0.0/16 ----------------+
   |  public subnet 10.10.1.0/24                     |
   |     [ load balancer ]   ports 80 and 443 open   |
   |               |                                 |
   |  private subnet 10.10.2.0/24                    |
   |     [ app ]  [ app ]    accept only the LB      |
   |               |                                 |
   |  private subnet 10.10.3.0/24                    |
   |     [ database ]        accepts only the apps   |
   +---------------+---------------------------------+
                   |
             [ NAT gateway ] --> Internet           outbound updates only
```

A request travels from DNS to the CDN, to the load balancer in the public subnet, then to an app server and the database, neither of which has a public address. Security groups express the chain by reference: the database group accepts port 5432 only from members of the app group, so adding an app server needs no rule change.

### Load balancers and CDNs in the picture

A layer 4 load balancer forwards TCP or UDP connections without reading them: fast and protocol-agnostic. A layer 7 load balancer understands HTTP, so it can route by hostname or path, terminate TLS and rewrite headers. Both run health checks and stop sending traffic to a server that fails them. For the trade-offs between appliances, software and managed services, see [hardware, software or managed load balancers](https://cloudsat.io/learn/hardware-software-or-managed-load-balancer).

A CDN caches static content at edge locations and passes dynamic requests through to your origin, here the load balancer. Lock the origin down so it accepts traffic only from the CDN, otherwise attackers can skip the edge and hit your servers directly.

## The same design on plain VPS servers

Some VPS providers give every server public IPv4 and IPv6 addresses but no private network. The isolation is still within reach, built from four parts:

1. **Private links with WireGuard.** Each server gets an address on a `wg0` interface, and internal services listen only there.
2. **Two firewall layers.** The provider's cloud firewall drops traffic before it reaches the server; a host firewall (UFW or nftables) enforces the same policy on the machine.
3. **A software load balancer.** HAProxy, Caddy or nginx on a front server, with a floating IP that can move to a standby. [Two web servers behind HAProxy](https://cloudsat.io/learn/load-balance-two-servers-with-haproxy) walks through it.
4. **A CDN in front**, exactly as in the cloud layout.

Create a key pair on each server, then describe the peers. On the database server:

```bash
sudo apt install -y wireguard
wg genkey | sudo tee /etc/wireguard/private.key | wg pubkey | sudo tee /etc/wireguard/public.key
sudo chmod 600 /etc/wireguard/private.key
```

```ini
# /etc/wireguard/wg0.conf on the database server
[Interface]
Address = 10.10.0.3/24
ListenPort = 51820
PrivateKey = <database-private-key>

[Peer]
# app server
PublicKey = <app-public-key>
AllowedIPs = 10.10.0.2/32
Endpoint = 203.0.113.20:51820
```

Bring the tunnel up, then let the database port through on the tunnel only:

```bash
sudo systemctl enable --now wg-quick@wg0
sudo wg show                                   # a recent handshake means the peers can talk
sudo ufw default deny incoming
sudo ufw allow from 198.51.100.0/24 to any port 22 proto tcp   # SSH from your office range
sudo ufw allow 51820/udp
sudo ufw allow in on wg0 to any port 5432 proto tcp
sudo ufw enable
```

Finish by binding PostgreSQL to the tunnel address with `listen_addresses = '10.10.0.3'` in `postgresql.conf`, and allow only the app server's tunnel address in `pg_hba.conf`. From outside your office range, the database's public address now answers nothing: the WireGuard port stays silent to any packet without a valid key. For internal names, add the tunnel addresses to `/etc/hosts` on each server, or run a small resolver once the list grows.

On CloudSat, every server has its own IPv4 and IPv6 address and the console's [cloud firewalls](https://cloudsat.io/docs/cloud-firewalls) take inbound rules, so this layout needs only WireGuard and a host firewall on top.

## Check what is actually exposed

Whatever the design, verify it from the outside. From a machine that is not part of the network, list what answers:

```bash
nc -vz -w 3 203.0.113.30 5432      # database port on the public address: should time out
nc -vz -w 3 203.0.113.10 443       # the front door: should connect
```

Then, on each server, list what is listening and on which address. A service bound to `0.0.0.0` or `[::]` listens on every interface, including the public one:

```bash
sudo ss -tlnp
```

## FAQ

### Is a VPC more secure than a firewall?

A VPC provides isolation and routing, not policy. Security still comes from the rules: a database in a VPC with a permissive security group is as exposed as one with an open host firewall. Use both layers, and keep rules as narrow as the application allows.

### Do I need a NAT gateway?

Only when servers without public addresses need outbound internet, for updates or API calls. If every server has a public address, or you use IPv6, you do not. On many platforms NAT gateways are metered by the hour and by the gigabyte, so check that line before adding one.

### What is the difference between a security group and a network ACL?

A security group is stateful and attaches to a server: allow an inbound connection and the replies flow back automatically. A network ACL is stateless and applies to a whole subnet, so you must allow both directions explicitly. Most designs rely on security groups and keep ACLs coarse.

### Can WireGuard replace a VPC between servers?

For a handful of servers, yes, and it encrypts the traffic too. Past a dozen peers, manage the configuration with automation, or use a mesh tool that distributes keys for you.

**Run it on CloudSat.** Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. [See plans](https://cloudsat.io/plans) or [deploy a server](https://dash.cloudsat.io/console/deploy).

## Keep reading

[All guides in Networking](https://cloudsat.io/learn/topic/networking-and-dns)

- [Load balancing in practice: two web servers behind HAProxy](https://cloudsat.io/learn/load-balance-two-servers-with-haproxy): Networking Load balancing in practice: two web servers behind HAProxy 8 min read
- [Hardware, software or managed load balancer: how to choose](https://cloudsat.io/learn/hardware-software-or-managed-load-balancer): Networking Hardware, software or managed load balancer: how to choose 6 min read
- [Cloud architecture explained: components, state and diagrams](https://cloudsat.io/learn/cloud-architecture-explained-with-one-app): Cloud and hosting Cloud architecture explained: components, state and diagrams 7 min read
- [IPv4 vs IPv6: what changes when you run servers](https://cloudsat.io/learn/ipv4-vs-ipv6-for-server-admins): Networking IPv4 vs IPv6: what changes when you run servers 6 min read
