Network Layer
The network layer is responsible for addressing and routing across multiple networks.
Why It Matters
- Routing mistakes lead to "host/network unreachable" incidents.
- NAT behavior impacts service exposure and debugging.
- Subnet design determines scalability and blast radius.
IP Addressing
IPv4 and IPv6
| Topic | IPv4 | IPv6 |
|---|---|---|
| Length | 32-bit | 128-bit |
| Notation | 192.168.1.10 | 2001:db8::10 |
| Address Space | Limited | Very large |
CIDR and Subnets
- CIDR
/24means 24 network bits. - Subnetting controls address capacity and segmentation.
Routing Fundamentals
Routers forward packets based on the longest-prefix match.
Useful commands:
ip route
traceroute api.example.com
NAT (Network Address Translation)
Common NAT Types
- SNAT: internal source translated to egress public IP.
- DNAT: inbound traffic forwarded to internal destination.
Typical backend impact:
- Client IP visibility depends on proxy/NAT chain.
- Connection tracking table limits can drop traffic under load.
ICMP for Diagnostics
ICMP supports control messages used by ping and path diagnostics.
ping -c 4 1.1.1.1
mtr -rw api.example.com
Cloud and Kubernetes Notes
- VPC/VNet subnet planning should reserve growth headroom.
- Kubernetes CNI allocates pod IPs; check overlap with node/service CIDRs.
- Security group/NACL policy can mimic routing failures.
Incident Patterns
Pattern: Host Unreachable
- Verify local route table.
- Check next-hop gateway reachability.
- Confirm subnet and security policy alignment.
Pattern: Intermittent packet loss
- Compare behavior by path/region.
- Check MTU mismatch and fragmentation.
- Inspect congestion and queue drops.