CIDR (Classless Inter-Domain Routing) notation: 192.168.1.0/24 — 24 bit đầu là network prefix, 8 bit còn lại là host. /24 = 256 địa chỉ (2^8), 254 usable (trừ network address và broadcast). Phổ biến: /8 (class A, 16M hosts), /16 (class B, 65K hosts), /24 (class C, 254 hosts). Private ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
Tính subnet nhanh: /24 → subnet mask 255.255.255.0; /25 → 128 hosts, 2 subnet từ /24; /26 → 64 hosts, 4 subnets.
Trong AWS VPC: tạo VPC /16, chia thành subnets /24 (1 per AZ) — public subnet (route to Internet Gateway) và private subnet (route to NAT Gateway). Security Group và Network ACL hoạt động ở layer subnet/instance.
Thực tế lập trình: khi Docker tạo container network 172.17.0.0/16, Kubernetes pod CIDR thường 10.244.0.0/16, node CIDR 10.0.0.0/24. Hiểu CIDR giúp debug network connectivity issues giữa containers và services.
CIDR (Classless Inter-Domain Routing) notation: 192.168.1.0/24 — the first 24 bits are the network prefix and the remaining 8 bits are for hosts. /24 = 256 addresses (2^8), 254 usable (minus the network address and broadcast). Common sizes: /8 (class A, 16M hosts), /16 (class B, 65K hosts), /24 (class C, 254 hosts). Private ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
Quick subnet calculation: /24 → subnet mask 255.255.255.0; /25 → 128 hosts, 2 subnets from a /24; /26 → 64 hosts, 4 subnets.
In AWS VPC: create a VPC as /16, subdivide into /24 subnets (one per AZ) — public subnets (route to an Internet Gateway) and private subnets (route to a NAT Gateway). Security Groups and Network ACLs operate at the subnet/instance level.
In practice: Docker creates container networks at 172.17.0.0/16, Kubernetes pod CIDRs are typically 10.244.0.0/16, and node CIDRs 10.0.0.0/24. Understanding CIDR helps debug network connectivity issues between containers and services.