Octet

Cloud networking

0 of 36 nailed

Core15

  1. What is a VPC, and how do an AWS VPC, an Azure VNet and a GCP VPC differ?

    Say this first

    A VPC is a private, isolated network you define inside a cloud provider: you pick the address space, cut it into subnets, and control routing and filtering. An AWS VPC and an Azure VNet are regional. A GCP VPC is global: one network spans every region, and only its subnets are regional.

    Go deeper

    What you get

    • An address space you choose (RFC 1918 normally), split into subnets.
    • Route tables that decide where traffic leaves each subnet.
    • Stateful filters on instances or subnets (security groups, NSGs, firewall rules).
    • Gateways for the outside world: internet, NAT, VPN, private circuits, peering.

    The provider runs the actual forwarding in its own software-defined fabric. There is no broadcast and no real layer 2: ARP is answered by the hypervisor, and multicast is not supported by default.

    Scope differences

    AWS VPCAzure VNetGCP VPC
    ScopeOne regionOne regionGlobal
    Subnet scopeOne AZRegion (spans zones)Region (spans zones)
    Address spaceSet on the VPC, /16 to /28, secondary CIDRs allowedSet on the VNet, can add rangesSet per subnet, no VPC-level CIDR
    Routing and firewall objectsPer subnet route tables, per ENI security groupsRoute tables per subnet, NSGs per subnet or NICRoutes and firewall rules belong to the whole VPC

    Why the GCP model matters

    In GCP two VMs in different regions of the same VPC talk over Google's backbone with no peering and no gateway. In AWS or Azure the same design needs one VPC or VNet per region plus peering or a transit hub between them.

    Traps

    • Saying an AWS VPC spans regions. It is regional; only GCP VPCs are global.
    • Treating a subnet like a VLAN where layer 2 tricks (VRRP, gratuitous ARP) just work.
  2. How do subnets relate to availability zones, and how many addresses do you lose in each subnet?

    Say this first

    In AWS a subnet lives in exactly one availability zone, so for high availability you build one subnet per tier per AZ. Azure and GCP subnets are regional and span zones. AWS and Azure reserve 5 addresses in every subnet and GCP reserves 4, so a /28 in AWS gives 11 usable addresses, not 14.

    Go deeper

    AWS

    A subnet is tied to one AZ (us-east-1a, for example). A typical layout for two AZs:

    SubnetAZCIDR
    public-aus-east-1a10.10.0.0/24
    public-bus-east-1b10.10.1.0/24
    private-aus-east-1a10.10.10.0/24
    private-bus-east-1b10.10.11.0/24

    Reserved in 10.10.10.0/24: .0 network, .1 VPC router, .2 Amazon DNS, .3 reserved for future use, .255 broadcast (broadcast is not supported, but the address is still held back). Subnet size is /16 to /28.

    Azure

    A subnet spans all zones in the region; you pick the zone per VM or per zonal resource. Azure reserves .0 network, .1 default gateway, .2 and .3 for Azure DNS mapping, and the last address. The smallest subnet is /29. Some services need a dedicated subnet with a fixed name, such as GatewaySubnet for VPN and ExpressRoute gateways and AzureFirewallSubnet for Azure Firewall.

    GCP

    Subnets are regional. GCP reserves the network address, the gateway (.1), the second-to-last address and the broadcast address in the primary range.

    Traps

    • Forgetting the 5 reserved addresses when sizing small subnets for load balancers or endpoints.
    • Assuming Azure subnets are zonal like AWS subnets.
    How did you do?Own page
  3. What actually makes a subnet public or private in AWS?

    Say this first

    Only its route table. A public subnet is associated with a route table that has a default route (0.0.0.0/0) to an internet gateway. A private subnet has no route to an internet gateway; it usually sends 0.0.0.0/0 to a NAT gateway instead. The instance also needs a public IP to be reachable from the internet.

    Go deeper

    The three conditions for an instance to talk to the internet directly

    1. Its subnet's route table has 0.0.0.0/0 (or ::/0) pointing to an igw- target.
    2. It has a public IPv4 address or an Elastic IP (or a global IPv6 address).
    3. Security group and network ACL allow the traffic.

    Miss any one and it does not work. "Public subnet" is not a checkbox; it is a label people use for condition 1. The "auto-assign public IPv4" subnet setting only helps with condition 2.

    Typical route tables

    Output
    rtb-public                       rtb-private-a
    10.10.0.0/16  local              10.10.0.0/16  local
    0.0.0.0/0     igw-0c1d2e3f4a5b60789  0.0.0.0/0  nat-0f1e2d3c4b5a69788

    Why private subnets

    Databases and app servers should not be reachable from the internet at all. In a private subnet they can still start outbound connections (updates, APIs) through the NAT gateway, but nothing can open a connection to them from outside.

    Traps

    • Saying a subnet is public because instances in it got public IPs.
    • Forgetting that the route table association decides it, and a subnet with no explicit association uses the main route table.
    How did you do?Own page
  4. How do route tables work in a VPC, and how is that different in Azure and GCP?

    Say this first

    In AWS each subnet is associated with exactly one route table; subnets without an explicit association use the main route table. Every table has a local route for the VPC CIDR that you cannot delete. Lookups use longest prefix match. Azure starts with system routes and lets you override them with user-defined routes per subnet. GCP routes belong to the whole VPC and can be scoped with network tags.

    Go deeper

    AWS

    • Local route. 10.10.0.0/16 local is in every table. All subnets in the VPC can reach each other unless a security group or NACL stops it.
    • Targets. igw-, nat-, pcx- (peering), tgw-, vgw-, eni- (an appliance), vpce- (gateway or GWLB endpoint), egress-only IGW for IPv6.
    • Selection. Longest prefix match first. For identical prefixes, static routes beat propagated (BGP) routes.
    • Propagation. A route table can learn routes from a virtual private gateway when route propagation is enabled for it.
    • Gateway route tables. You can associate a route table with the internet gateway or virtual private gateway itself (edge association) to steer inbound traffic through a firewall appliance.

    Azure

    Every subnet gets system routes: the VNet range, peered VNets, 0.0.0.0/0 to Internet, and next hop None for RFC 1918 and 100.64.0.0/10 ranges that are not in the VNet. You attach a route table of user-defined routes (UDRs) to a subnet with next hop types such as VirtualAppliance, VirtualNetworkGateway, Internet or None. For the same prefix, a UDR beats a BGP route, which beats a system route.

    GCP

    Routes are VPC-wide objects. Subnet routes are created for you. A default route to the default internet gateway exists until you delete it. Custom static routes have a priority (lower wins on a tie) and can apply only to instances with a network tag. Cloud Router adds dynamic routes, either for its own region or for all regions depending on the VPC's dynamic routing mode.

    Traps

    • Thinking a route table is per VPC in AWS. It is associated per subnet.
    • Forgetting the main route table. A new subnet silently uses it until you associate another.
    How did you do?Own page
  5. What is the difference between an internet gateway and a NAT gateway?

    Say this first

    An internet gateway gives a VPC two-way internet access for instances that have public IPs; it does one-to-one NAT between the public and private address. A NAT gateway lets instances with only private addresses start outbound connections and share one Elastic IP, while blocking inbound connections. A NAT gateway is zonal, sits in a public subnet, and needs its own route to the internet gateway.

    Go deeper

    Internet gateway (IGW)

    • One per VPC, highly available by design, no bandwidth knob to size.
    • Does static 1:1 NAT for instances with public IPv4 or Elastic IPs. The instance OS only ever sees its private address.
    • For IPv6 there is no NAT. An egress-only internet gateway gives outbound-only IPv6, which is the IPv6 equivalent of a NAT gateway's protection.

    NAT gateway

    • Created in one subnet of one AZ. A public NAT gateway has an Elastic IP and must sit in a public subnet (route 0.0.0.0/0 to the IGW).
    • Private subnets route 0.0.0.0/0 to it. It translates source address and port (PAT).
    • Supports up to 55,000 simultaneous connections to each unique destination (IP, port, protocol).
    • For AZ resilience you deploy one per AZ and point each private subnet at the NAT gateway in its own AZ. One shared NAT gateway is a single point of failure and adds cross-AZ data charges.
    • A private NAT gateway has no Elastic IP and translates to its private address. It is used to reach other networks (for example through a transit gateway) when address ranges overlap.
    • You cannot attach a security group to it. The subnet's network ACL still applies.

    Equivalents

    • Azure: NAT Gateway, a managed resource associated with subnets, using public IPs or prefixes. Each public IP gives 64,512 SNAT ports.
    • GCP: Cloud NAT, configured on a Cloud Router. It is software-defined: there is no NAT box in the data path, the translation happens in the host networking stack.

    Traps

    • Placing the NAT gateway in a private subnet. It looks healthy and nothing works.
    • Assuming one NAT gateway is regional and highly available. It lives in one AZ.
    How did you do?Own page
  6. Security groups versus network ACLs. What is the difference, and when would you use each?

    Say this first

    A security group is a stateful firewall on each network interface. It has allow rules only, all rules are evaluated together, and return traffic is allowed automatically. A network ACL is stateless and applies to the whole subnet. Its numbered rules are checked lowest first, the first match wins, it can allow or deny, and you must open return traffic yourself, usually ephemeral ports 1024 to 65535.

    Go deeper

    Security groupNetwork ACL
    Attached toENI (instance, endpoint, load balancer)Subnet
    StateStatefulStateless
    RulesAllow onlyAllow and deny
    EvaluationAll rules, most permissive winsBy rule number, lowest first, first match
    SourcesCIDR, prefix list, another security groupCIDR only
    DefaultNew SG: no inbound, all outboundDefault NACL allows all; a new custom NACL denies all

    How I use them

    • Security groups do the real work. Reference groups instead of addresses: the app SG allows port 8080 from the web SG, the DB SG allows 5432 from the app SG. Instances can be replaced or scaled and the rules still hold.
    • NACLs are a coarse guard rail. Block a known bad range, or enforce "this subnet never talks to that subnet" as a second layer. Keep them simple, because every rule needs a matching return rule.

    The return traffic trap

    A NACL that allows inbound 443 must also allow outbound to the client's ephemeral ports, and a subnet whose instances make outbound calls needs inbound rules for the replies. Linux uses 32768 to 60999, Windows uses 49152 to 65535, and load balancers can use anything from 1024. Allowing 1024 to 65535 is the usual answer.

    Traps

    • Saying network ACLs are stateful, or that security groups support deny rules.
    • Forgetting outbound ephemeral ports on a NACL, then blaming the application.
    How did you do?Book 8.5 Example SystemsOwn page
  7. An EC2 instance has a public IP, but ip addr inside the OS shows only a 10.x address. Why?

    Say this first

    The public address never reaches the instance. The internet gateway does one-to-one NAT: outbound it rewrites the private source to the public IP, inbound it rewrites the public destination back to the private IP. An auto-assigned public IP changes on stop and start; an Elastic IP is a static address you own until you release it. AWS charges for every public IPv4 address, attached or not.

    Go deeper

    How it works

    The instance's ENI has 10.10.0.25. AWS maps 203.0.113.25 to it at the edge. Applications must not bind to the public address, and anything that embeds its own IP in the payload (SIP, FTP active mode) needs to be told the public address.

    Auto-assigned public IP vs Elastic IP

    Auto-assignedElastic IP
    LifetimeReleased on stop or terminateYours until released
    Move between instancesNoYes, remap in seconds
    Use casesThrowaway or test instancesNAT gateways, allow-listed partners, fixed DNS

    Cost

    Since February 2024 AWS charges an hourly fee for every public IPv4 address, in use or idle. That is one more reason to keep servers private behind load balancers and NAT, and to look at IPv6.

    Azure and GCP

    Same idea: Azure public IP resources attach to a NIC or a load balancer, and GCP external IPs (ephemeral or static) are attached to the VM's access config. The guest OS sees only the internal address in both.

    Traps

    • Configuring the Elastic IP as a secondary address inside the OS. It breaks nothing only by luck.
    • Saying the instance "has" the public IP on its interface.
    How did you do?Own page
  8. What are the ways to connect an on-prem data center to the cloud, and how do you choose?

    Say this first

    Three families: an IPsec site-to-site VPN over the internet, a private circuit (AWS Direct Connect, Azure ExpressRoute, Google Cloud Interconnect), or an SD-WAN overlay that extends into the cloud. VPN is quick and cheap but limited in bandwidth and rides the internet. A private circuit gives steady latency, higher bandwidth and cheaper egress but takes weeks to order. Most enterprises run a circuit as primary and a VPN as backup.

    Go deeper

    Site-to-site VPNPrivate circuitSD-WAN into cloud
    Lead timeMinutesWeeks (cross-connect, provider)Days
    BandwidthAround 1.25 Gbps per AWS tunnel, scale with ECMP50 Mbps to 100 GbpsDepends on appliances
    PathPublic internet, encryptedPrivate, not encrypted by defaultOverlay over any transport
    LatencyVaries with the internetPredictableVaries
    CostHourly per connectionPort hours plus lower egress ratesLicenses plus cloud instances

    How I choose

    • Proof of concept or small office: VPN.
    • Production data center with steady traffic or latency-sensitive apps: two circuits in two locations, with a VPN as a cheap extra backup.
    • Many branches already on SD-WAN: extend the fabric with virtual appliances in a transit VPC or VNet, or the provider's native SD-WAN integration (AWS Transit Gateway Connect, Azure Virtual WAN).
    • Compliance requires encryption on the circuit: MACsec where supported, or IPsec over the circuit.

    BGP is the routing protocol on every one of these options; static routing exists for VPNs but loses automatic failover.

    Traps

    • Saying a private circuit is encrypted because it is private.
    • Proposing a single circuit as "redundant" because the provider has two routers.
    How did you do?Own page
  9. What does it mean that VPC peering is non-transitive, and why does it matter?

    Say this first

    A peering connection only carries traffic between the two VPCs it joins. If A peers with B and B peers with C, A cannot reach C through B. A also cannot use B's internet gateway, NAT gateway, VPN, Direct Connect or gateway endpoint. Full connectivity between n VPCs needs n(n-1)/2 peerings, so beyond a handful of VPCs you move to a transit gateway.

    Go deeper

    Rules in AWS

    • One-to-one, between two VPCs, same or different account, same or different region.
    • CIDRs must not overlap.
    • No edge-to-edge routing: traffic must start or end in one of the two peered VPCs.
    • Both sides must add routes to the other VPC's CIDR with the pcx- target, and security groups must allow the traffic. Peering by itself routes nothing.
    • In the same region, security groups can reference a group in the peer VPC.
    • No hourly charge. Data across AZs or regions is charged as usual.

    The scaling math

    VPCsPeerings for full mesh
    510
    1045
    501225

    Each one also needs route entries on both sides. That is where a transit gateway wins.

    Other clouds

    • Azure VNet peering is non-transitive too. The exceptions are gateway transit (spokes use the hub's VPN or ExpressRoute gateway) and routing through a network virtual appliance with UDRs.
    • GCP VPC Network Peering is non-transitive. It exchanges subnet routes, and custom routes only if you enable import and export.

    Traps

    • Adding the route in one VPC only. Replies need a route back.
    • Assuming a peer VPC can use your NAT gateway for internet access.
    How did you do?Book 3.4 RoutingOwn page
  10. Walk me through an AWS site-to-site VPN. What do you get, and how does it stay redundant?

    Say this first

    You create a customer gateway (your device's public IP and ASN), a virtual private gateway on the VPC or a transit gateway, and a VPN connection between them. Each VPN connection has two IPsec tunnels ending on two AWS endpoints in different AZs. You run BGP over both tunnels (or use static routes) and AWS gives each tunnel a /30 inside address from 169.254.0.0/16. For real redundancy you add a second customer device with its own VPN connection.

    Go deeper

    Pieces

    • Customer gateway (CGW): a record of your public IP and BGP ASN.
    • Virtual private gateway (VGW): attached to one VPC. Amazon side ASN defaults to 64512. Or terminate on a transit gateway to serve many VPCs.
    • VPN connection: two tunnels, each to a different AWS endpoint. IKEv1 or IKEv2, PSK or certificates.

    Inside addressing

    Each tunnel gets a /30 such as 169.254.10.0/30. AWS uses the first host (169.254.10.1), your router uses the second (169.254.10.2). BGP runs between those addresses.

    Behaviour worth knowing

    • By default your device must start IKE; AWS waits. Tunnel options can make AWS initiate with IKEv2.
    • A standard tunnel carries around 1.25 Gbps. A VGW will not load-share across tunnels. A transit gateway can ECMP across tunnels and across several VPN connections with BGP.
    • Dead peer detection timeout defaults to 30 seconds.
    • AWS-provided sample configs clamp TCP MSS on the tunnel interface to avoid fragmentation.

    Equivalents

    • Azure VPN Gateway (route-based) lives in GatewaySubnet. Active-standby by default with one public IP; active-active uses two. Default Azure ASN for BGP is 65515.
    • GCP HA VPN has two interfaces with two external IPs. With tunnels from both interfaces and BGP on Cloud Router it carries a 99.99% SLA; Classic VPN is 99.9%.

    Traps

    • Configuring only one tunnel because "it works".
    • Thinking a VGW load-balances over both tunnels. It does not; a TGW with ECMP does.
    How did you do?Book 8.5 Example SystemsOwn page
  11. ALB, NLB and GWLB. What is each one for?

    Say this first

    An Application Load Balancer works at layer 7: it terminates HTTP and HTTPS, routes on host, path and headers, and always opens a new connection to the target, passing the client IP in X-Forwarded-For. A Network Load Balancer works at layer 4 for TCP, UDP and TLS, gives one static IP per AZ, handles very high rates with low latency, and can preserve the client IP. A Gateway Load Balancer sends traffic to firewall appliances inline, wrapped in GENEVE on UDP 6081.

    Go deeper

    ALBNLBGWLB
    Layer7 (HTTP, HTTPS, gRPC)4 (TCP, UDP, TLS)3, transparent
    RoutingHost, path, header, query, methodPort and protocolAll traffic to appliances
    Static IPNo, use the DNS nameOne per AZ, or Elastic IPsNot addressed by clients
    Client IP at targetIn X-Forwarded-ForPreserved for instance targets by defaultOriginal packet inside GENEVE
    Typical useWeb apps, microservices, WAFNon-HTTP, extreme rates, PrivateLink servicesInline firewalls and IDS

    Notes that come up

    • ALB node addresses change. Partners who need a fixed IP get an NLB, or Global Accelerator in front.
    • An NLB can be the front of a PrivateLink endpoint service; an ALB cannot by itself (you can put an ALB behind an NLB as a target).
    • GWLB is used with GWLB endpoints placed as route targets in VPC route tables, so traffic is steered to the appliance fleet and back without changing addresses.

    Other clouds

    AWSAzureGCP
    ALBApplication Gateway (regional), Front Door (global)Application Load Balancer
    NLBAzure Load Balancer (Standard)Network Load Balancer, passthrough or proxy
    GWLBGateway Load BalancerInternal passthrough Network LB as a route next hop
    Route 53 DNS steeringTraffic ManagerCloud DNS routing policies

    Traps

    • Saying an ALB has a static IP.
    • Putting UDP traffic behind an ALB. Only an NLB handles UDP.
    How did you do?Book 9.1 Traditional ApplicationsOwn page
  12. What routing policies does Route 53 offer, and when is an alias record better than a CNAME?

    Say this first

    Simple, weighted, latency-based, failover, geolocation, geoproximity, multivalue answer and IP-based. Weighted shifts a percentage of traffic, latency sends users to the closest region by measured latency, failover returns a standby when the primary's health check fails. An alias record points to an AWS resource, works at the zone apex where a CNAME is not allowed, and alias queries to AWS resources are free.

    Go deeper

    Policies

    PolicyAnswers withTypical use
    SimpleOne record setA single endpoint
    WeightedRecords in proportion to weightsCanary or blue-green, 90/10
    LatencyThe region with lowest latency for the resolverActive-active multi-region
    FailoverPrimary, or secondary if the primary is unhealthyActive-passive DR
    GeolocationBy continent, country or US stateCompliance, localized content
    GeoproximityBy distance with a biasShift load between regions
    Multivalue answerUp to 8 healthy recordsSimple client-side spreading
    IP-basedBy the client's source network (CIDR collections)Steer known ISPs or offices

    Health checks

    • Checkers in several AWS regions probe the endpoint, every 30 seconds by default (10 seconds as an option), and mark it unhealthy after 3 failures by default.
    • They run from the internet, so they cannot probe a private IP. For private endpoints, base the health check on a CloudWatch alarm.
    • Failover is only as fast as the record TTL lets clients notice. Keep TTLs short (60 seconds or less) on records you expect to fail over.

    Alias vs CNAME

    • A CNAME cannot sit at the apex (example.com) because the apex already has SOA and NS records and a CNAME cannot coexist with other data.
    • An alias is a Route 53 feature that returns the target's A or AAAA records directly, follows the target's address changes, and is free for queries to AWS targets such as ELB, CloudFront and S3 websites.

    Private hosted zones

    Answer only inside the VPCs they are associated with. Useful for internal names and split-horizon DNS.

    Traps

    • Promising instant DNS failover. Clients and resolvers cache answers for the TTL, and some ignore it.
    • Pointing a Route 53 health check at a private IP.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  13. Explain the Kubernetes networking model. How do pods on different nodes talk to each other?

    Say this first

    Every pod gets its own IP, and every pod can reach every other pod on any node without NAT. Each node gets a slice of the pod CIDR, often a /24. The CNI plugin creates the pod's interface, assigns the IP and makes the cross-node path work, either with an overlay (VXLAN or IP-in-IP), with plain routing (BGP or cloud route tables), or by giving pods real VPC addresses like the AWS VPC CNI and Azure CNI do.

    Go deeper

    Inside a node

    Each pod has its own network namespace. The CNI plugin creates a veth pair: one end is eth0 in the pod, the other sits on the host, attached to a bridge or routed by the host. Containers in one pod share the namespace and talk over localhost.

    Between nodes

    ApproachHowExamples
    OverlayEncapsulate pod packets between node IPsFlannel VXLAN, Calico VXLAN or IP-in-IP, Cilium VXLAN or Geneve
    RoutedAdvertise each node's pod CIDRCalico with BGP, cloud route tables
    VPC-nativePods get VPC addresses, the cloud fabric routes themAWS VPC CNI, Azure CNI, GKE VPC-native (alias IPs)

    Overlay works anywhere but adds encapsulation overhead and lowers the pod MTU. VPC-native avoids the overlay and makes pods first-class in security groups and flow logs, but uses VPC addresses fast.

    What CNI is

    The Container Network Interface is a spec and a set of plugins. The container runtime calls the plugin with ADD and DEL when a pod sandbox is created or removed. The plugin handles interface setup and IPAM. Network policy enforcement is a separate capability that some CNIs provide (Calico, Cilium) and others do not (Flannel on its own).

    Three ranges to plan

    Node addresses, the pod CIDR and the service CIDR. None of them may overlap with each other or with networks pods must reach.

    Traps

    • Saying pods talk through NAT by default. The model requires no NAT between pods.
    • Forgetting that the pod CIDR must not overlap with on-prem networks the pods call.
  14. What are ClusterIP, NodePort and LoadBalancer Services, and how are they implemented?

    Say this first

    A Service gives a stable virtual IP and DNS name to a changing set of pods. ClusterIP is the default and is reachable only inside the cluster. NodePort also opens a port, from 30000 to 32767 by default, on every node. LoadBalancer asks the cloud for an external load balancer that sends traffic to the nodes or straight to pods. kube-proxy, or an eBPF data plane like Cilium, programs the translation from the virtual IP to the pod IPs listed in the EndpointSlices.

    Go deeper

    Types

    TypeReachable fromNotes
    ClusterIPInside the clusterVirtual IP from the service CIDR
    NodePortAny node IP on a high portBuilds on ClusterIP
    LoadBalancerOutside, through a cloud LBBuilds on NodePort unless the controller targets pods directly
    ExternalNameInside, as a DNS CNAMENo proxying, just DNS
    Headless (clusterIP: None)InsideDNS returns pod IPs; used by StatefulSets

    Data path

    1. Pods matching the selector and passing readiness probes are listed in EndpointSlices.
    2. kube-proxy watches them and writes rules: iptables DNAT chains, IPVS virtual servers, or nftables in newer releases. Cilium can replace kube-proxy with eBPF.
    3. A packet to 10.96.40.12:80 is translated to a chosen pod, for example 10.244.3.17:8080.
    4. CoreDNS answers web.shop.svc.cluster.local with the ClusterIP.
    YAML
    apiVersion: v1
    kind: Service
    metadata:
      name: web
      namespace: shop
    spec:
      type: ClusterIP
      selector:
        app: web
      ports:
        - port: 80
          targetPort: 8080

    Traps

    • Saying a Service is a pod or a process. It is a virtual IP plus rules.
    • Exposing many services with one cloud load balancer each, which gets expensive. That is what ingress is for.
    How did you do?Own page
  15. How do you design a cloud network to survive the loss of an availability zone?

    Say this first

    Use at least two, preferably three AZs. Give every tier a subnet in each AZ, spread instances across them with auto scaling, put load balancers in all of them, and run one NAT gateway per AZ with each private subnet routed to its local one. Use zone-redundant managed services, and avoid anything that pins a tier to one AZ, such as a single NAT gateway or a single-AZ database.

    Go deeper

    What an AZ is

    One or more data centers in a region with separate power, cooling and networking, joined to the other AZs by low-latency links. AZ failures are rare but real; region failures are rarer.

    Checklist

    • Subnets: public, private and data subnets in each AZ.
    • Compute: auto scaling groups across AZs, with enough headroom that two AZs carry the load of three.
    • Load balancers: enabled in every AZ that has targets.
    • NAT: one NAT gateway per AZ. A single NAT gateway makes every AZ depend on one.
    • Data: Multi-AZ databases, replicated caches.
    • Hybrid: VPN tunnels and transit gateway attachments already span AZs; make sure the subnets chosen for attachments cover every AZ you use.

    AZ names are per account

    us-east-1a in one account is not necessarily us-east-1a in another. AWS publishes AZ IDs such as use1-az1 that are the same everywhere; use them when lining up shared subnets or partner connections.

    Azure and GCP

    Azure regions with zones expose zones 1, 2 and 3; resources are zonal or zone-redundant. GCP zones such as us-central1-a and regional managed instance groups play the same role.

    Traps

    • Building redundancy at the instance level but leaving a single NAT gateway or single-AZ database.
    • Matching AZs between accounts by name instead of AZ ID.
    How did you do?Own page

Working15

  1. How do Azure network security groups and GCP firewall rules compare with AWS security groups?

    Say this first

    All three are stateful. Azure NSGs allow and deny, use priorities 100 to 4096 (lower wins), and attach to a subnet, a NIC or both, so traffic must pass both. GCP firewall rules belong to the whole VPC, use priorities 0 to 65535, allow or deny, and target instances by network tag or service account, with an implied deny for ingress and allow for egress. AWS security groups are allow-only and per interface.

    Go deeper

    Azure NSG

    • Custom rules use priority 100 to 4096. Default rules sit at 65000 and up: allow VNet to VNet, allow Azure Load Balancer probes inbound, allow internet outbound, then deny all.
    • Service tags such as VirtualNetwork, Internet, AzureLoadBalancer and Storage stand in for address lists Microsoft maintains.
    • Application security groups (ASGs) group NICs by role, so a rule says "web ASG to app ASG on 8080", close to AWS security group referencing.
    • With NSGs on both subnet and NIC: inbound is checked at the subnet first, then the NIC; outbound at the NIC first, then the subnet. Both must allow.
    • Watch out: VirtualNetwork includes peered VNets and on-prem ranges learned through a gateway, so the default allow is wider than people think.

    GCP VPC firewall rules

    • Defined on the VPC, applied in every region. Direction is ingress or egress.
    • Priority 0 to 65535, default 1000. Implied rules at the lowest priority deny all ingress and allow all egress.
    • Targets: all instances, instances with a network tag, or instances running as a service account. Service accounts are stronger because changing them needs IAM permission, while tags are editable by anyone who can edit the VM.
    • Hierarchical and network firewall policies add organization-wide rules above the VPC rules.

    AWS

    Allow-only, per ENI, all rules evaluated, other security groups as sources. Network ACLs are the place for explicit deny.

    Traps

    • Saying GCP firewall rules are per subnet. They are per VPC with targets.
    • Forgetting that an Azure NSG on the subnet and another on the NIC must both allow.
    How did you do?Own page
  2. How would you plan IP addressing for a company moving to the cloud?

    Say this first

    I treat cloud ranges as part of the corporate plan, not separate. I reserve a large block per cloud and region, give each VPC a non-overlapping range sized for growth, keep it unique against on-prem, partners and other VPCs, and track it all in an IPAM. I avoid ranges that collide with common defaults like 172.17.0.0/16 for Docker and 10.0.0.0/16 for every tutorial.

    Go deeper

    Principles

    • Unique everywhere. Anything that may ever be peered, routed over a transit hub or reached from on-prem must not overlap. Overlap is cheap to avoid on day one and very expensive to fix later.
    • Hierarchical. For example 10.64.0.0/10 for AWS, split by region (10.64.0.0/13 us-east-1, 10.72.0.0/13 eu-west-1), then a /16 to /20 per VPC. Summaries per region keep the on-prem and transit route tables short.
    • Size for growth. Kubernetes and serverless consume IPs quickly. A /16 VPC is not wasteful if the block is planned; a /24 VPC that has to be rebuilt is.
    • Leave room in each VPC. Do not carve the whole VPC into subnets on day one. You can add subnets but you cannot resize existing ones.
    • Use a tool. AWS VPC IPAM or NetBox as the source of truth, so teams request ranges instead of guessing.

    Ranges to avoid

    RangeWhy
    172.17.0.0/16Docker's default bridge. Hosts running Docker cannot reach it.
    10.0.0.0/16, 192.168.0.0/24, 192.168.1.0/24Defaults everywhere, including home routers of VPN users.
    100.64.0.0/10Carrier-grade NAT space; often reused for Kubernetes pods. Plan it explicitly.
    169.254.0.0/16Link-local; used by metadata services and VPN tunnel inside addresses.

    Kubernetes ranges count too

    Pod and service CIDRs that are not VPC addresses still must not overlap anything pods need to reach. EKS, for example, picks 10.100.0.0/16 or 172.20.0.0/16 for services if you do not set one.

    Traps

    • Letting every team pick 10.0.0.0/16 because it is the console default.
    • Forgetting partner networks and acquisitions when checking for overlap.
    How did you do?Own page
  3. Where does data transfer cost money in AWS, and how do you design to keep egress costs down?

    Say this first

    Inbound from the internet is free. You pay for data out to the internet, between regions, between availability zones (in each direction), and for processing through NAT gateways, transit gateways and interface endpoints. I keep chatty traffic inside one AZ where the design allows, send S3 and DynamoDB traffic through free gateway endpoints instead of NAT, and cache or compress what leaves.

    Go deeper

    The meters that surprise people (us-east-1 list prices, they change, always check)

    PathCharge
    Internet egressRoughly 0.09 USD per GB for the first tier, cheaper at volume
    Between AZs in a region0.01 USD per GB out of one AZ and 0.01 USD per GB into the other
    NAT gateway0.045 USD per hour plus 0.045 USD per GB processed
    Transit gatewayPer attachment per hour plus about 0.02 USD per GB processed
    Between regionsCharged per GB, varies by region pair

    Design habits

    • Gateway endpoints for S3 and DynamoDB. They are route table entries, free, and remove that traffic from the NAT gateway. A backup job pushing terabytes to S3 through NAT is a classic bill shock.
    • NAT gateway per AZ. Besides resilience, it avoids paying inter-AZ charges on every outbound byte.
    • AZ affinity. Keep app-to-cache and app-to-database traffic in the same AZ when the service supports it; replicate across AZs on purpose, not by accident.
    • CDN in front of public content. CloudFront or another CDN offloads repeated downloads.
    • Direct Connect for heavy hybrid traffic. Data transfer out over Direct Connect is billed at a lower rate than internet egress.
    • Measure. VPC Flow Logs plus Cost Explorer by usage type (DataTransfer-Regional-Bytes, NatGateway-Bytes) shows who is moving data.

    Other clouds

    Azure and GCP follow the same shape: free ingress, paid internet and inter-region egress. GCP also charges for traffic between zones in a region.

    Traps

    • Saying all traffic inside a region is free. Cross-AZ traffic is not.
    • Quoting exact prices as permanent facts. Give the shape and say you would check the current price list.
    How did you do?Own page
  4. How does DNS work inside a VPC, and how do you make on-prem and cloud resolve each other's names?

    Say this first

    Every VPC has the Amazon-provided resolver at the VPC base address plus two (10.10.0.2 for 10.10.0.0/16) and at 169.254.169.253. It answers public names, private hosted zones and instance names. For hybrid DNS I use Route 53 Resolver endpoints: an inbound endpoint that on-prem DNS servers forward cloud zones to, and an outbound endpoint with forwarding rules that send on-prem zones to the corporate DNS.

    Go deeper

    VPC settings

    • enableDnsSupport turns the Amazon resolver on (default true).
    • enableDnsHostnames gives instances DNS hostnames (default false in custom VPCs). Private hosted zones need both set to true.
    • Private hosted zones are associated with specific VPCs, so the same name can resolve differently inside and outside (split-horizon).

    Hybrid with Route 53 Resolver

    Output
    on-prem DNS --- conditional forward aws.corp.example --> inbound endpoint IPs (ENIs in the VPC)
    VPC resolver --- rule: forward corp.example --------> outbound endpoint --> on-prem DNS 192.168.10.53

    Each endpoint has ENIs in at least two AZs. Forwarding rules can be shared to other accounts with AWS RAM and associated with many VPCs.

    Azure and GCP

    • Azure: the platform resolver is 168.63.129.16. Private DNS zones link to VNets. Azure DNS Private Resolver gives inbound and outbound endpoints plus forwarding rulesets, the same pattern as Route 53 Resolver. Before it existed, people ran DNS forwarder VMs.
    • GCP: Cloud DNS private zones, forwarding zones to on-prem, and an inbound server policy that gives on-prem a forwarding target inside the VPC.

    Traps

    • Forgetting enableDnsHostnames and wondering why the private hosted zone does not resolve.
    • Running only one resolver endpoint ENI, which makes DNS the single point of failure for hybrid traffic.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  5. What is a transit gateway and how does it replace a peering mesh?

    Say this first

    An AWS transit gateway is a regional router you attach VPCs, VPNs, Direct Connect gateways and other transit gateways to. Each attachment is associated with one TGW route table, used for its lookups, and can propagate its routes into one or more route tables. That gives hub-and-spoke routing with segmentation, instead of a full mesh of peerings. Azure does the same with Virtual WAN or a hub VNet with a firewall, and GCP with Network Connectivity Center.

    Go deeper

    Building blocks

    • Attachments: VPC (one subnet per AZ, best as a small dedicated /28), site-to-site VPN, Direct Connect gateway (through a transit VIF), TGW peering (between regions, static routes only), and Connect (GRE plus BGP for SD-WAN appliances).
    • Route tables: a TGW can have many. Association says which table an attachment uses when its traffic enters the TGW (exactly one). Propagation says which tables learn that attachment's routes (zero or more).
    • Static routes can be added, including blackhole routes that drop traffic.
    • VPC side: the VPC's own route tables still need routes such as 10.0.0.0/8 to tgw-....

    Packet walk

    Output
    VPC A instance -> VPC A route table (10.0.0.0/8 to tgw) -> TGW attachment A
      -> lookup in the route table associated with A -> attachment B -> VPC B local route -> instance

    Things to know

    • It is a regional resource. Inter-region needs TGW peering with static routes.
    • It charges per attachment hour and per GB processed, so it is not free like peering.
    • With BGP VPNs it can ECMP across many tunnels, which is how you get past the per-tunnel bandwidth.
    • Amazon side ASN defaults to 64512 unless you set it at creation.

    Equivalents

    • Azure Virtual WAN: a Microsoft-managed hub with transitive routing between VNets, VPN, ExpressRoute and point-to-site. The do-it-yourself version is a hub VNet with Azure Firewall or an NVA, spokes peered to it, and UDRs pointing at the firewall.
    • GCP Network Connectivity Center: a hub with VPC spokes and hybrid spokes (VPN, Interconnect, router appliances).

    Traps

    • Confusing association (where I look up) with propagation (where my routes are learned).
    • Forgetting the VPC route table entry pointing to the TGW.
    How did you do?Own page
  6. You have Direct Connect plus two VPN tunnels to the same VPC. How does AWS pick a path, and how do you steer it?

    Say this first

    Longest prefix match comes first. For the same prefix on a virtual private gateway, AWS prefers Direct Connect BGP routes, then static VPN routes, then BGP VPN routes. Between BGP VPN paths it takes the shortest AS path, then the lowest MED. So I steer AWS's return traffic with prefix length and AS path prepending on the backup, and I steer my outbound traffic with local preference on my own routers.

    Go deeper

    AWS side (traffic from the VPC to on-prem)

    1. Most specific prefix wins. Advertising 10.20.0.0/16 over DX and 10.0.0.0/8 over VPN keeps traffic on DX until the /16 is withdrawn.
    2. Same prefix: Direct Connect BGP, then VPN static, then VPN BGP.
    3. Between VPN BGP routes: shortest AS path, then lowest MED.

    To make tunnel 2 the backup, advertise the same prefixes on it with a prepended AS path:

    Cisco IOS
    route-map AWS-TUN2-OUT permit 10
     set as-path prepend 65010 65010
    !
    router bgp 65010
     address-family ipv4
      neighbor 169.254.20.1 route-map AWS-TUN2-OUT out

    Your side (traffic from on-prem to AWS)

    Your routers choose. Set a higher local preference on routes learned over DX, and keep the VPN routes at the default 100 so they are used only when DX disappears.

    Transit gateway is different

    A TGW can ECMP across VPN tunnels when the paths are equal and ECMP is enabled. That is a feature for bandwidth, and a trap when you wanted active-standby: then make the paths unequal on purpose.

    Traps

    • Using local preference to influence AWS. It never leaves your AS; AWS cannot see it.
    • Advertising a more specific prefix over the VPN by accident and pulling all traffic off DX.
    How did you do?Own page
  7. Explain AWS Direct Connect. What are the connection types and virtual interfaces?

    Say this first

    Direct Connect is a private Ethernet connection from your router to AWS at a Direct Connect location. A dedicated connection is a physical port, typically 1, 10 or 100 Gbps; a hosted connection is a slice sold by a partner. Over it you run 802.1Q virtual interfaces, each with its own BGP session: a private VIF to reach VPCs, a public VIF to reach AWS public endpoints, and a transit VIF to reach transit gateways through a Direct Connect gateway.

    Go deeper

    Connection types

    • Dedicated: a cross-connect to an AWS router port in a colocation facility. You order it, get a Letter of Authorization (LOA-CFA), and have the cross-connect run.
    • Hosted: a partner already connected to AWS provisions a VLAN for you at a fixed bandwidth, from as little as 50 Mbps.

    Virtual interfaces

    VIFReachesAttaches to
    PrivateVPC private addressesA VGW, or a Direct Connect gateway
    TransitMany VPCs via transit gatewaysA Direct Connect gateway associated with TGWs
    PublicAWS public service addresses (S3, DynamoDB, public endpoints)AWS public prefixes, needs public IPs

    A Direct Connect gateway is a global object: one private or transit VIF can reach VGWs or TGWs in many regions. It does not route VPC to VPC through itself.

    Rules that cause outages

    • BGP is mandatory on every VIF.
    • A private VIF accepts at most 100 prefixes from you. Advertise more and the BGP session goes down. Summarize.
    • Direct Connect is not encrypted. MACsec is available on some dedicated connections; otherwise run IPsec over it.

    Redundancy

    One connection is a single point of failure. AWS's guidance for critical workloads is connections at two separate Direct Connect locations, each on separate devices, with BFD for fast failover and a VPN as an optional last resort.

    Traps

    • Advertising a full internal routing table over a private VIF and dropping the session.
    • Calling Direct Connect secure because it is private.
    How did you do?Own page
  8. How does Azure ExpressRoute work, and what is the GCP equivalent?

    Say this first

    An ExpressRoute circuit is a private connection, through a provider or ExpressRoute Direct, into Microsoft's edge. Every circuit has a primary and a secondary link to two Microsoft edge routers, both active, each with its own BGP session. Private peering reaches VNets through an ExpressRoute gateway in the VNet's GatewaySubnet; Microsoft peering reaches Microsoft 365 and Azure public services. Microsoft's ASN is 12076. GCP offers Dedicated and Partner Interconnect with BGP on Cloud Router.

    Go deeper

    Circuit anatomy

    • Ordered at a peering location with a bandwidth (provider circuits from 50 Mbps up to 10 Gbps; ExpressRoute Direct gives you 10 or 100 Gbps ports).
    • Two links, two BGP sessions per peering. For private peering you supply two /30 subnets (one per link), a VLAN ID and your ASN.
    • Private peering: to VNets. Needs an ExpressRoute virtual network gateway in GatewaySubnet. FastPath can send data around the gateway for high-throughput cases.
    • Microsoft peering: to public Microsoft services, with public IPs and route filters.
    • Global Reach: connects two of your circuits so two on-prem sites talk over Microsoft's backbone.
    • Premium add-on: reach VNets in other geopolitical regions and a larger route limit.

    Not encrypted

    Same as Direct Connect. MACsec is available on ExpressRoute Direct; otherwise IPsec over private peering.

    GCP Cloud Interconnect

    • Dedicated Interconnect: your own 10 or 100 Gbps circuits into a Google colocation.
    • Partner Interconnect: through a provider, smaller sizes.
    • VLAN attachments connect to a Cloud Router, which runs BGP and installs routes in the VPC. Google publishes the topologies (two metros, four connections) needed for the 99.99% SLA.

    Mapping across clouds

    AWSAzureGCP
    Direct Connect connectionExpressRoute circuitInterconnect connection
    Private VIFPrivate peeringVLAN attachment
    Public VIFMicrosoft peeringPrivate Google Access for on-prem hosts
    BGP on your router to AWSBGP to the Microsoft edge routersBGP to Cloud Router

    Traps

    • Thinking the secondary link is standby. Both are active by default.
    • Forgetting the ExpressRoute gateway SKU when planning bandwidth.
    How did you do?Own page
  9. In an Azure hub-and-spoke, what do allow forwarded traffic, gateway transit and use remote gateways do?

    Say this first

    Allow forwarded traffic lets a VNet accept packets that did not originate in the peer, such as traffic routed through a firewall in the hub. Allow gateway transit on the hub side and use remote gateways on the spoke side let spokes use the hub's VPN or ExpressRoute gateway. Spoke-to-spoke traffic still needs UDRs pointing at a firewall or NVA in the hub, because peering is not transitive.

    Go deeper

    Peering settings, set on each side

    SettingWhereEffect
    Allow virtual network accessBothBasic reachability between the two VNets
    Allow forwarded trafficBoth, as neededAccept traffic forwarded by an NVA in the peer
    Allow gateway transitHub to spoke peeringOffer the hub's gateway to the spoke
    Use remote gatewaysSpoke to hub peeringUse the hub's gateway; the spoke cannot have its own

    Spoke-to-spoke routing

    Spoke 1 and spoke 2 are peered only with the hub. To connect them:

    • Route table on spoke 1 subnets: 10.2.0.0/16 next hop VirtualAppliance at the firewall IP (for example 10.0.1.4).
    • Route table on spoke 2 subnets: 10.1.0.0/16 to the same firewall.
    • Firewall policy allows the flow. Forwarded traffic allowed on the peerings.

    Gateway route propagation

    A route table has a "propagate gateway routes" setting. Turning it off on spoke subnets stops on-prem routes learned by the gateway from bypassing the firewall; a UDR then sends on-prem traffic to the firewall instead.

    Traps

    • Expecting spoke-to-spoke traffic to flow through the hub just because both are peered to it.
    • Forgetting the return UDR on the second spoke, which causes asymmetric routing around the firewall.
    How did you do?Own page
  10. How do target health checks and cross-zone load balancing work on AWS load balancers?

    Say this first

    Each target group has its own health check. For an ALB the defaults are HTTP on the traffic port, path /, every 30 seconds, 5 second timeout, healthy after 5 passes and unhealthy after 2 failures. Removed targets drain for the deregistration delay, 300 seconds by default. Cross-zone load balancing spreads traffic over targets in all AZs: it is always on at the ALB level and off by default on an NLB.

    Go deeper

    Health checks

    • Probes come from the load balancer nodes' private IPs. The target security group must allow them, ideally by referencing the load balancer's security group.
    • Point the check at a real health endpoint (/healthz) that tests dependencies the instance needs, not just "the web server answers".
    • Success codes default to 200 for an ALB; you can widen it, for example 200-399.
    • Fail open: if every target in a target group is unhealthy, the load balancer sends traffic to all of them anyway. A bad health check path does not cause an outage, but it hides the real health.

    Deregistration delay

    During scale-in or deploys, a target stops getting new connections but keeps existing ones for up to 300 seconds. Short-lived HTTP services often lower it to 30 seconds to speed up deploys.

    Cross-zone

    ALBNLBGWLB
    DefaultOn (can be turned off per target group)OffOff
    Cost when onNo inter-AZ chargeInter-AZ data charges applyInter-AZ data charges apply

    With cross-zone off, each AZ's load balancer node only uses targets in its own AZ. If AZ a has 2 targets and AZ b has 8, each AZ still gets half the traffic, so the 2 targets in AZ a run four times hotter.

    Traps

    • Forgetting to allow the health check from the load balancer's security group.
    • Uneven target counts per AZ with cross-zone off.
    How did you do?Own page
  11. How does a backend learn the real client IP behind cloud load balancers?

    Say this first

    It depends on whether the load balancer proxies or passes packets through. An ALB, Application Gateway or GCP proxy load balancer adds the client IP to X-Forwarded-For. An NLB preserves the source IP for instance targets by default, but not for IP targets with TCP or TLS, where you enable client IP preservation or proxy protocol v2. Azure Load Balancer and GCP passthrough load balancers do not rewrite the source at all.

    Go deeper

    By load balancer

    Load balancerHow the client IP arrives
    AWS ALBX-Forwarded-For, plus X-Forwarded-Proto and X-Forwarded-Port
    AWS NLB, instance targetsSource IP preserved by default
    AWS NLB, IP targets, TCP or TLSNot preserved by default; turn on preservation or proxy protocol v2
    AWS NLB, UDPPreserved
    Azure Load BalancerPassthrough, source preserved
    Azure Application GatewayX-Forwarded-For
    GCP passthrough Network LBSource preserved
    GCP Application LB and proxy Network LBX-Forwarded-For, or PROXY protocol for TCP proxy

    Side effects of preserving the client IP

    • The target's security group must allow the real client addresses, not just the load balancer.
    • Replies must go back through the load balancer path. With a passthrough design, a server whose default route points elsewhere breaks the flow.
    • Hairpin: with NLB client IP preservation, a target that connects to its own NLB and is balanced to itself sees a packet from its own IP to its own IP, and the connection fails.

    Kubernetes

    A LoadBalancer Service with externalTrafficPolicy: Cluster lets kube-proxy send traffic to a pod on another node, and it SNATs the packet, so the pod sees a node IP. externalTrafficPolicy: Local keeps traffic on nodes that run a pod and preserves the client IP, at the cost of possibly uneven spread.

    Traps

    • Turning on proxy protocol on the NLB without enabling it on the backend, which then fails every request.
    • Assuming an NLB always preserves the client IP whatever the target type.
    How did you do?Own page
  12. What is an Ingress, and how is it different from a LoadBalancer Service and the Gateway API?

    Say this first

    An Ingress is a set of HTTP and HTTPS rules (host and path to Service) that an ingress controller turns into real proxy configuration. One load balancer and controller can serve many Services, with TLS termination in one place. A LoadBalancer Service is one external load balancer per Service at layer 4. The Gateway API is the newer, role-oriented replacement for Ingress, with Gateways and routes for HTTP, gRPC, TCP and more. The Ingress API itself is frozen.

    Go deeper

    Ingress needs a controller

    The Ingress object does nothing on its own. The controller watches it and configures a proxy:

    • Self-hosted proxies (NGINX-based, Traefik, HAProxy, Envoy-based) running as pods behind one LoadBalancer Service.
    • Cloud-managed: the AWS Load Balancer Controller builds an ALB from an Ingress; GKE builds a Google Application Load Balancer.
    YAML
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: shop
      namespace: shop
    spec:
      ingressClassName: alb
      tls:
        - hosts: [shop.example.com]
          secretName: shop-tls
      rules:
        - host: shop.example.com
          http:
            paths:
              - path: /api
                pathType: Prefix
                backend:
                  service:
                    name: api
                    port:
                      number: 80

    With the AWS controller, TLS is normally done with an ACM certificate annotation rather than a secret.

    Gateway API

    Split by role: the platform team owns GatewayClass and Gateway (listeners, certificates), app teams own HTTPRoute objects that attach to it. It supports header matching, traffic splitting and more protocols without controller-specific annotations.

    Traps

    • Creating an Ingress with no controller installed and wondering why nothing happens.
    • Mixing annotations from one controller into another controller's ingress class.
    How did you do?Own page
  13. How do Kubernetes NetworkPolicies work, and what usually goes wrong with them?

    Say this first

    By default every pod can talk to every pod. Once any NetworkPolicy selects a pod for ingress or egress, that direction becomes deny by default for the pod and only what some policy allows gets through. Policies are additive allow lists with no deny rule. They only work if the CNI enforces them, and the classic mistakes are forgetting DNS on egress and mixing up the AND versus OR form of selectors.

    Go deeper

    Default deny plus an allow

    YAML
    apiVersion: networking.k8s.io/v1
    kind: NetworkPolicy
    metadata:
      name: default-deny-ingress
      namespace: shop
    spec:
      podSelector: {}
      policyTypes: [Ingress]
    ---
    apiVersion: networking.k8s.io/v1
    kind: NetworkPolicy
    metadata:
      name: api-from-web
      namespace: shop
    spec:
      podSelector:
        matchLabels:
          app: api
      policyTypes: [Ingress]
      ingress:
        - from:
            - podSelector:
                matchLabels:
                  app: web
          ports:
            - protocol: TCP
              port: 8080

    The AND vs OR trap

    YAML
    # One element: namespace AND pod must match
    - from:
        - namespaceSelector: {matchLabels: {team: web}}
          podSelector: {matchLabels: {app: web}}
    # Two elements: namespace OR pod matches
    - from:
        - namespaceSelector: {matchLabels: {team: web}}
        - podSelector: {matchLabels: {app: web}}

    One dash changes the meaning and can open a namespace wide.

    Enforcement

    Calico, Cilium, the AWS VPC CNI with its network policy agent, and Azure's options enforce policies. Flannel alone does not, and the API server accepts the objects anyway, so nothing warns you.

    Traps

    • Assuming policies work on any cluster. The CNI must enforce them.
    • Forgetting that a policy with only ingress rules leaves egress wide open for the same pods.
    How did you do?Own page
  14. Two instances in AWS cannot talk. How do you troubleshoot it, and what do flow logs not show you?

    Say this first

    I follow the path both ways: route tables at the source and at the destination, then security groups, then network ACLs in both directions, then the OS firewall and whether the app listens. Reachability Analyzer checks the configuration hop by hop without sending packets. VPC Flow Logs show ACCEPT or REJECT decisions by security groups and NACLs, but they do not log packets dropped for lack of a route, and they skip some traffic such as Amazon DNS and instance metadata.

    Go deeper

    Order of checks

    1. Routing, both directions. The return route is the one people forget.
    2. Security groups. Inbound on the destination, outbound on the source.
    3. Network ACLs. Both subnets, both directions, including ephemeral return ports.
    4. Host. ss -ltnp to see the listener, iptables or Windows Firewall, the app's bind address.

    Flow logs

    Output
    2 123456789012 eni-0a1b2c3d4e5f60718 10.10.10.25 10.20.10.40 49152 5432 6 10 840 1731230000 1731230060 REJECT OK

    Version, account, ENI, source, destination, ports, protocol (6 is TCP), packets, bytes, window start and end, action, log status. A REJECT points at a security group or NACL.

    Not captured: traffic to the Amazon DNS resolver, the instance metadata service, the Amazon Time Sync service, DHCP, and Windows license activation. Records are aggregated over an interval (10 minutes by default, 1 minute as an option), so they are not real time.

    Tools by cloud

    AWSAzureGCP
    Reachability AnalyzerNetwork Watcher IP flow verify, next hop, connection troubleshootConnectivity Tests
    VPC Flow LogsVNet flow logsVPC Flow Logs, firewall rules logging
    Traffic MirroringPacket capturePacket Mirroring

    Traps

    • Treating the absence of a REJECT as proof the network is fine. Routing drops never show.
    • Checking only the source side. Most cloud connectivity bugs are on the return path.
    How did you do?Own page

Expert6

  1. Two VPCs, or a VPC and an on-prem site, use the same CIDR and now must talk. What are your options?

    Say this first

    The clean fix is to re-address one side. If that is not possible, I would expose only the services needed through PrivateLink, which does not care about overlap, or translate addresses: a private NAT gateway in a small routable secondary range, NAT on a VPN gateway or appliance, or load balancers in routable subnets for inbound flows. Plain peering is out, because AWS refuses peering between overlapping VPCs.

    Go deeper

    Option 1: re-IP

    Painful, but it removes the problem forever. Often the right answer for a small VPC or a new acquisition.

    Option 2: PrivateLink (service-level connectivity)

    The provider puts the service behind an NLB and publishes an endpoint service. The consumer creates an interface endpoint, which takes an IP from the consumer's own subnet. Neither side ever routes to the other's range, so overlap does not matter. Limits: one direction only (consumer starts connections), and it exposes services, not whole networks.

    Option 3: NAT with a private NAT gateway (AWS pattern)

    1. Add a small, unique secondary CIDR to each VPC (the routable range), for example 100.64.10.0/24.
    2. Keep workloads in the overlapping, non-routable range.
    3. Put a private NAT gateway in a routable subnet. Outbound traffic to the other network is SNATed to it and sent via the transit gateway.
    4. For inbound, place an internal ALB or NLB in the routable subnets with targets in the overlapping range.

    Option 4: NAT on the edge

    For on-prem overlap, translate on the VPN or firewall: Azure VPN Gateway supports NAT rules, and a firewall or router appliance in a transit VPC can do static or dynamic NAT. Every translated service needs DNS that returns the translated address.

    What I tell the interviewer

    Overlap is a planning failure; NAT is a workaround that adds state, breaks protocols that embed addresses, and complicates troubleshooting. I would choose PrivateLink for a few services and re-IP for broad connectivity.

    Traps

    • Suggesting VPC peering. AWS will not create a peering connection between overlapping CIDRs.
    • Forgetting DNS. After NAT, clients must resolve names to the translated addresses.
    How did you do?Own page
  2. How would you segment prod, dev and shared services on a transit gateway, and where does inspection fit?

    Say this first

    I use separate TGW route tables. Prod attachments associate with a prod table that learns prod, shared services and on-prem routes. Dev associates with a dev table that learns dev and shared services only. Shared services learns everything. For inspection, spoke tables send traffic to an inspection VPC attachment, and I turn on appliance mode on that attachment so both directions of a flow hit the same firewall in the same AZ.

    Go deeper

    Route tables

    TGW route tableAssociated attachmentsPropagations from
    rt-prodprod VPCsprod VPCs, shared VPC, VPN or DX
    rt-devdev VPCsdev VPCs, shared VPC
    rt-sharedshared services VPCprod, dev, VPN or DX

    Prod and dev never learn each other's routes, so there is no path. That is routing-based isolation; security groups still apply inside.

    Blackhole routes

    If a spoke table has 0.0.0.0/0 to a central egress VPC, I add a blackhole route for the internal supernet (for example 10.0.0.0/8). Traffic to an internal range nobody has propagated is dropped at the TGW instead of wandering toward the NAT gateways. Longer propagated routes still win by longest prefix match.

    Inspection VPC

    • Spoke tables have 0.0.0.0/0 (or the internal supernet) to the inspection VPC attachment.
    • The inspection VPC sends traffic through AWS Network Firewall endpoints or a Gateway Load Balancer with third-party firewalls, then back to the TGW.
    • The inspection attachment is associated with a table that knows all spoke routes.

    Why appliance mode

    By default a TGW keeps traffic in the AZ where it entered. If the source is in AZ a and the destination in AZ b, the request enters the inspection VPC in AZ a and the reply in AZ b. Two different firewalls see the two halves; the stateful one that sees the reply has no session and drops it. With appliance mode enabled on the inspection VPC attachment, the TGW picks one AZ for the flow and uses it for both directions.

    Traps

    • Forgetting appliance mode and seeing random drops only for cross-AZ flows.
    • Treating TGW route tables as firewalls. They decide reachability, not ports.
    How did you do?Own page
  3. A private endpoint works from inside the VNet but on-prem users still hit the public IP. Why, and how do you fix it?

    Say this first

    Private endpoints depend on DNS. The public name has a CNAME to a privatelink name, and only networks that use the private DNS zone get the private A record. On-prem DNS asks the internet and gets the public IP. The fix is a conditional forwarder on-prem for the service's zone to a resolver inside the cloud (Azure DNS Private Resolver inbound endpoint or Route 53 Resolver inbound endpoint), so the query is answered with the private zone.

    Go deeper

    Azure example

    Output
    mystore.blob.core.windows.net
      CNAME mystore.privatelink.blob.core.windows.net
        inside a VNet linked to privatelink.blob.core.windows.net  -> A 10.50.2.4
        anywhere else (public DNS)                                 -> public IP
    1. Create the private DNS zone privatelink.blob.core.windows.net, link it to the hub VNet, and let the private endpoint register its record there.
    2. Deploy Azure DNS Private Resolver with an inbound endpoint in the hub (or a DNS forwarder VM that uses 168.63.129.16).
    3. On-prem DNS: conditional forwarder for blob.core.windows.net to the inbound endpoint IP. Microsoft recommends forwarding the public zone name, not the privatelink name, so the CNAME chain is followed inside Azure.

    168.63.129.16 itself is only reachable from inside Azure, which is why on-prem cannot forward to it directly.

    AWS equivalent

    An interface endpoint with private DNS creates a hidden private hosted zone for the service name in that VPC. On-prem forwards the service domain to a Route 53 Resolver inbound endpoint. For endpoints shared from a central VPC, turn private DNS off on the endpoint, create your own private hosted zone for the service name with an alias to the endpoint, and associate that zone with every spoke VPC.

    Design rule

    One private DNS zone per privatelink name for the whole organisation, linked to the VNets or VPCs that need it. Duplicate zones in different hubs give different answers depending on where you ask.

    Traps

    • Forwarding only the privatelink zone and breaking the CNAME chain for some clients.
    • Opening the firewall to the public endpoint "to make it work", which defeats the private endpoint.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  4. How would you design networking for an organisation with dozens of AWS accounts?

    Say this first

    A dedicated network account owns the transit gateway, the Direct Connect gateway, central egress and inspection, and shared DNS and endpoints. Workload accounts get VPCs from an IPAM pool and attach to the TGW, which is shared through AWS RAM. Segmentation lives in TGW route tables, inspection in a central firewall VPC with appliance mode, and internet egress goes through NAT gateways in one egress VPC per region. GCP does the same with Shared VPC, Azure with a hub VNet or Virtual WAN.

    Go deeper

    The pieces

    • Network account: TGW per region (shared via RAM), TGW peering between regions, Direct Connect gateway with transit VIFs, VPN backup.
    • IPAM: pools per region and environment so every VPC gets a unique, summarizable range.
    • Inspection VPC: AWS Network Firewall or GWLB with third-party firewalls, for east-west and egress.
    • Egress VPC: NAT gateways per AZ. Spokes have no IGW or NAT of their own.
    • Shared services VPC: interface endpoints shared through private hosted zones, Route 53 Resolver endpoints and rules shared with RAM, directory services.
    • Guard rails: service control policies that stop spoke accounts from creating IGWs or peering on their own.

    Alternative: VPC sharing

    AWS RAM can share subnets of one VPC with many accounts. Accounts launch resources in shared subnets, the network team owns routing. Fewer VPCs and attachments, but a bigger blast radius per VPC.

    Trade-offs to state out loud

    • Central egress saves NAT gateway hours across many VPCs but adds TGW processing charges per GB.
    • Central inspection adds a hop and cost; inspect what policy requires, not everything by default.
    • One TGW per region is a shared dependency; change control on its route tables matters.

    Other clouds

    • GCP Shared VPC: a host project owns the VPC and subnets; service projects use them. Combine with NCC or VPN and Interconnect in the host project.
    • Azure: a hub VNet per region with Azure Firewall, gateways and DNS resolver, spokes per subscription, policy to enforce UDRs. Virtual WAN is the managed version.

    Traps

    • Designing without IPAM and discovering overlap after the first acquisition.
    • Forgetting cross-region traffic needs TGW peering with static routes.
    How did you do?Own page
  5. An EKS cluster stops scheduling pods because the subnets ran out of IPs. Why does that happen, and how do you fix it?

    Say this first

    The AWS VPC CNI gives every pod a real VPC address from secondary IPs on the node's ENIs, and it keeps a warm pool of spare addresses per node. Busy clusters burn through small subnets fast. Fixes, in order of effort: tune the warm pool, turn on prefix delegation so each ENI slot holds a /28, use custom networking to put pods in a large secondary CIDR such as one from 100.64.0.0/10, or run the cluster on IPv6.

    Go deeper

    Why it runs out

    • Max pods per node is bounded by ENIs times IPs per ENI. The classic formula is ENIs x (IPs per ENI - 1) + 2. An m5.large has 3 ENIs with 10 IPs each, so 3 x 9 + 2 = 29 pods.
    • The CNI pre-allocates: by default it keeps a whole spare ENI's worth of addresses warm on every node. Fifty nodes can reserve hundreds of idle addresses.

    Fixes

    FixWhat it doesWatch out for
    WARM_IP_TARGET, MINIMUM_IP_TARGETKeep fewer idle IPs per nodeMore EC2 API calls when pods churn
    Prefix delegationAssigns /28 prefixes (16 addresses) per ENI slot, raising pods per nodeNeeds free contiguous /28s; fragmented subnets fail. Nitro instances only
    Custom networkingENIConfig per AZ puts pods in subnets from a secondary VPC CIDRThe primary ENI no longer hosts pods, so max pods drops
    IPv6 clusterPods get IPv6 from a huge prefixEvery dependency must handle IPv6 or go through egress translation

    Custom networking sketch

    1. Add a secondary CIDR to the VPC, for example 100.64.0.0/16.
    2. Create pod subnets per AZ from it.
    3. Set AWS_VPC_K8S_CNI_CUSTOM_NETWORK_CFG=true and create one ENIConfig per AZ.
    4. Pods take addresses from the large range; nodes keep their routable addresses. Pod traffic leaving the VPC is SNATed to the node IP by default, so the 100.64 range does not need to be routable on-prem.

    Traps

    • Sizing EKS subnets as /24s because "we only have ten nodes".
    • Enabling prefix delegation on a fragmented subnet and getting allocation failures.
    How did you do?Own page
  6. What MTU do you get in AWS, and where do large packets get into trouble?

    Say this first

    Current instance types use jumbo frames, 9001 bytes, inside a VPC. Traffic through an internet gateway is limited to 1500. A transit gateway carries up to 8500 bytes between VPCs and Direct Connect, and drops anything larger. A site-to-site VPN supports an MTU of 1446 and MSS of 1406. Path MTU discovery needs the ICMP fragmentation-needed message, so security groups must allow it or large transfers hang.

    Go deeper

    AWS numbers

    PathMTU
    Inside a VPC (current instance types)9001
    Through an internet gateway1500
    Transit gateway between VPCs, Direct Connect, peering8500
    Site-to-site VPN1446 (MSS 1406)
    Direct Connect private VIF1500 or 9001 if jumbo is enabled
    Direct Connect transit VIF1500 or 8500 if jumbo is enabled

    Where it hurts

    • An instance with MTU 9001 sends large segments to a host across the transit gateway or the internet. If ICMP type 3 code 4 is blocked, the sender never learns to shrink, and transfers stall after the handshake.
    • On-prem over VPN: the tunnel overhead leaves less than 1500 for the inner packet. Clamp MSS on the tunnel interface of your router.

    What I do

    • Allow ICMP "destination unreachable, fragmentation needed" inbound in security groups for paths that cross gateways.
    • For instances that mostly talk off-VPC, set the interface MTU to 1500:
      Shell
      ip link show eth0
      sudo ip link set dev eth0 mtu 1500
    • Clamp MSS on VPN routers. AWS's sample Cisco config uses ip tcp adjust-mss 1379.

    GCP

    VPC networks default to an MTU of 1460 and can be raised up to 8896. The guest OS must match the VPC setting.

    Traps

    • Blocking all ICMP in security groups and NACLs "for security".
    • Assuming 1500 everywhere and missing that instances default to 9001 inside the VPC.
    How did you do?Book 3.3 Internet (IP)Own page