Scenario Questions
Real-world networking scenarios: what you would do, why, and how to say it in an interview
Addressing, CIDR & Routing
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q1 You own 10.0.0.0/16 for a new VPC and need separate /24 subnets for dev, QA and prod across two AZs. How do you carve it up?
Beginner
Situation read โ Classic subnetting question. /16 gives 256 possible /24s, so space is not the issue; the issue is leaving room to grow and keeping the plan readable.
What I'd do โ
- Give each environment a block of the third octet, for example dev
10.0.0.0/20, QA10.0.16.0/20, prod10.0.32.0/20, and leave10.0.48.0onward unallocated - Inside each /20 use /24s per AZ and tier, for example
10.0.32.0/24prod-public-a,10.0.33.0/24prod-public-b,10.0.34.0/24prod-private-a - Write the plan in a table in the repo and codify it in Terraform with
cidrsubnet("10.0.0.0/16", 4, 2) - Check with
ipcalc 10.0.32.0/20that the ranges do not overlap
Why โ Aligned blocks summarize cleanly in route tables and security rules (one /20 rule per environment instead of 16 /24 rules), and unallocated space lets you add a region or tier later.
Interview tip โ Say you never carve a VPC "as needed" because ad hoc allocation is what produces overlap when you later peer.
Q2 A host is configured as 192.168.1.130/25. What network does it belong to and what is the broadcast address?
Beginner
Situation read โ A /25 splits the last octet into two halves of 128 addresses: .0-.127 and .128-.255.
What I'd do โ
- Block size is 128, and 130 falls in the second block
- Network is
192.168.1.128, first usable.129, last usable.254, broadcast192.168.1.255 - Verify with
ipcalc 192.168.1.130/25orpython3 -c "import ipaddress as i; print(i.ip_network('192.168.1.130/25', strict=False))"
Why โ Network address is the host address ANDed with the mask; doing it by block size is faster than binary in an interview.
Interview tip โ Mention that cloud providers reserve extra addresses, so usable hosts differ from the textbook 2^n - 2.
Q3 How many usable IPs does an AWS subnet of /28 have?
Beginner
Situation read โ AWS reserves five addresses in every subnet, which surprises people who only know the textbook formula.
What I'd do โ
- A /28 has 16 addresses
- AWS reserves the first four (network, VPC router, DNS, future use) and the last one (broadcast, unused)
- Usable is 16 - 5 = 11
- Confirm with
aws ec2 describe-subnets --subnet-ids subnet-0abc --query 'Subnets[0].AvailableIpAddressCount'
Why โ The smallest subnet AWS allows is /28, and small subnets get eaten fast by ENIs from load balancers, Lambda in VPC and EKS nodes.
Interview tip โ Add that EKS with the VPC CNI can consume dozens of IPs per node, so /28 for anything but a tiny appliance is a trap.
Q4 A route table has 10.0.0.0/16 -> local and 10.0.1.0/24 -> vpn-gw. Where does a packet to 10.0.1.5 go?
Beginner
Situation read โ Two routes match the destination and the router must pick one.
What I'd do โ
- Apply longest prefix match: /24 is more specific than /16
- Packet goes to the VPN gateway, not local
- AWS now accepts routes more specific than the local route (for example to steer a subnet range to a firewall ENI), so check
aws ec2 describe-route-tablesfor what is really configured - On Linux test with
ip route get 10.0.1.5
Why โ Routers always prefer the most specific matching prefix before looking at metrics or administrative distance.
Interview tip โ Say you read the effective route table rather than assuming, because more-specific-than-local routes are legal in AWS today.
Q5 A newly built server can ping everything in its subnet but nothing outside. What is the first thing you check?
Beginner
Situation read โ Same-subnet traffic is L2 and needs no gateway. Anything off-subnet needs a default route and a working gateway.
What I'd do โ
- Run
ip routeand confirm there is adefault via <gw>line - Run
ip route get 8.8.8.8to see the chosen gateway and interface - Ping the gateway itself with
ping -c2 <gw>and checkip neighfor a REACHABLE entry - In cloud, check the subnet route table has
0.0.0.0/0to an IGW or NAT gateway
Why โ Same-subnet works while off-subnet fails almost always means a missing or wrong default gateway or route table entry.
Interview tip โ Walk the path outward: host, gateway, route table, NAT or IGW, then security controls.
Q6 You are picking a private range for a new company network. Which RFC 1918 range do you choose and why?
Beginner
Situation read โ Three ranges exist: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16. The wrong choice causes future conflicts.
What I'd do โ
- Choose from 10.0.0.0/8 because it gives the most room to subdivide by region and environment
- Avoid 192.168.0.0/16 and 172.17.0.0/16 because home routers and Docker use them
- Pick a non-obvious slice such as
10.84.0.0/14rather than starting at 10.0.0.0 - Register it in an IPAM tool so nobody else reuses it
Why โ Remote engineers on home networks and Docker bridges commonly collide with 192.168.x.x and 172.17.x.x, breaking VPN access.
Interview tip โ Say you plan addressing for merges and multi-cloud before the first VPC is created.
Q7 A server has two NICs and traffic to 10.20.0.0/16 is leaving through the wrong one. How do you see and fix the route?
Beginner
Situation read โ Multi-homed Linux hosts use the kernel routing table and the lowest-metric default route wins.
What I'd do โ
- Run
ip route get 10.20.1.5to see which interface and source IP are used - List all routes with
ip route show table all - Add a specific route:
sudo ip route add 10.20.0.0/16 via 10.20.0.1 dev eth1 - Persist it in netplan or NetworkManager, not only at runtime
Why โ Specific routes beat the default route, so a route for the destination prefix on the right interface fixes the problem without touching the default.
Interview tip โ Mention that runtime ip route add is lost on reboot, so the real fix lives in config management.
Q8 Why can't two VPCs with the same CIDR be peered?
Beginner
Situation read โ A router cannot decide where to send 10.0.1.5 if both sides own that prefix.
What I'd do โ
- Show the conflict: both route tables would need
10.0.0.0/16pointing at the peer and local at once - AWS rejects the peering request with an overlapping CIDR error
- Real options are re-IP one VPC, add a non-overlapping secondary CIDR for the shared workloads, or use PrivateLink for specific services
- Prevent it with a central IPAM, for example AWS VPC IPAM allocations
Why โ Peering is pure routing with no NAT, so addresses must be globally unique inside the connected domain.
Interview tip โ Offer PrivateLink as the answer when the requirement is only "expose one service" rather than full network reachability.
Q9 Plan IP addressing for a platform that will run 3 environments in 3 regions with 3 AZs each and 2 years of growth.
Intermediate
Situation read โ This is a design question where the interviewer wants hierarchy and summarization, not a random list of CIDRs.
What I'd do โ
- Assign each region a /12 or /14 from the corporate 10.0.0.0/8 plan, for example eu-west-1
10.16.0.0/14, ap-south-110.20.0.0/14 - Inside each region give each environment one VPC /16
- Split every VPC into tier subnets sized per AZ, public /24, private app /22, data /24, plus reserved space
- Reserve a pod CIDR separately (for example 100.64.0.0/10) if running EKS
- Document it in IPAM and enforce with Terraform validation
Why โ Hierarchical allocation means one summary route per region on the TGW or backbone and small firewall rule sets.
Interview tip โ Mention that you size private app subnets generously because they hold nodes, pods and load balancer ENIs.
Q10 Your company acquired another one and both use 10.0.0.0/8 with overlapping subnets. How do you connect them?
Intermediate
Situation read โ Full routed connectivity is impossible with overlap, so the answer is selective connectivity or renumbering.
What I'd do โ
- List which services really need cross-company access, often fewer than 10
- Expose those via PrivateLink endpoints or an API gateway instead of routing the networks
- Where a network path is unavoidable use a NAT appliance with a translated non-overlapping range on one side
- Start a re-IP project for the smaller network, migrating subnet by subnet
- Block the old ranges in the shared VPN to avoid half-working routes
Why โ NAT between overlapping networks works but is fragile (logs show translated IPs, protocols with embedded addresses break), so it must be a bridge, not the destination.
Interview tip โ Say the end state is renumbering, with NAT or PrivateLink only as the bridge.
Q11 Four /24s 10.1.0.0/24 through 10.1.3.0/24 sit behind a VPN. How do you advertise them efficiently?
Intermediate
Situation read โ Route summarization reduces table size and hides internal changes.
What I'd do โ
- Check the prefixes are contiguous and aligned on a power of two: 0,1,2,3 in the third octet
- Summarize to
10.1.0.0/22 - Advertise only the /22 over BGP or add it as one static route on the remote side
- Confirm no other host uses 10.1.0.0 to 10.1.3.255 outside the intended subnets
Why โ A summary is only valid if every address in it is reachable through that next hop, otherwise you attract traffic you cannot deliver.
Interview tip โ Mention that over-summarizing creates black holes and that AWS TGW lets you advertise summaries with attachments.
Q12 Users complain about random connection resets when a server has two uplinks and a stateful firewall in front. What is happening?
Intermediate
Situation read โ Classic asymmetric routing: the SYN goes out through firewall A and the reply returns through B, which has no state for the flow and drops it.
What I'd do โ
- Capture on both firewalls with
tcpdump -ni eth0 host 10.2.3.4 and port 443and check that each sees only half of the flow - Review routing on the server with
ip route get <client>to see the return path - Make routing symmetric by using source-based routing (
ip rule add from 10.2.3.4 table 100) or by pinning flows with ECMP hashing - If symmetry is impossible use state sync between the firewalls
Why โ Stateful devices track connections and only accept return traffic they have seen leave.
Interview tip โ Name the symptom correctly: SYN seen, no SYN-ACK or an ACK that gets dropped as invalid.
Q13 When do you pick static routes vs BGP between on-prem and AWS?
Intermediate
Situation read โ The decision depends on the number of prefixes, the need for failover and who owns changes.
What I'd do โ
- Use static routes for a single site, a handful of stable prefixes and a single tunnel
- Use BGP when you have multiple tunnels or circuits, many prefixes or need automatic failover
- With BGP on Site-to-Site VPN or Direct Connect, control path with local preference and AS-path prepending
- Monitor tunnel state with the
TunnelStateCloudWatch metric and BGP session alarms
Why โ BGP withdraws a dead path on its own, while static routes need a human or health tracking to fail over.
Interview tip โ Say you always prefer BGP for anything production because failover without human action is the point.
Q14 Your EKS cluster ran out of pod IPs in a /24 subnet. What are your options?
Intermediate
Situation read โ With the AWS VPC CNI each pod consumes a VPC IP, so small subnets exhaust quickly.
What I'd do โ
- Add a secondary CIDR to the VPC, for example
100.64.0.0/16, and create new subnets:aws ec2 associate-vpc-cidr-block --vpc-id vpc-0abc --cidr-block 100.64.0.0/16 - Enable custom networking so pods use ENIConfig subnets (
AWS_VPC_K8S_CNI_CUSTOM_CNI=true) - Enable prefix delegation (
ENABLE_PREFIX_DELEGATION=true) to assign /28 prefixes per ENI - Roll nodes so they pick up the new settings
Why โ Pod IPs come from the VPC; separating them into a secondary range keeps the primary range for nodes and load balancers.
Interview tip โ Mention IPv6 clusters as the long-term fix for IP exhaustion.
Q15 Traffic must flow through a virtual firewall instance in the middle of a VPC. How do you route it?
Intermediate
Situation read โ You need to steer traffic by route table to an instance ENI and let it forward packets that are not addressed to it.
What I'd do โ
- Add a route in the app subnet route table: destination
10.0.2.0/24target the firewall ENI - Disable the source/destination check:
aws ec2 modify-instance-attribute --instance-id i-0abc --no-source-dest-check - Enable forwarding in the instance:
sysctl -w net.ipv4.ip_forward=1 - Add the matching return route so traffic is symmetric
Why โ By default AWS drops packets whose source or destination is not the instance; routers and NAT boxes must opt out.
Interview tip โ For production prefer Gateway Load Balancer, which scales and health-checks appliances, over a single ENI route.
Q16 You have 12 VPCs that need to talk to each other. Peering or Transit Gateway?
Intermediate
Situation read โ Peering is non-transitive and needs a full mesh, so the link count grows quickly.
What I'd do โ
- Count: full mesh of 12 VPCs needs 66 peering connections and route table entries in each VPC
- Create one Transit Gateway and attach each VPC
- Use separate TGW route tables to control who can reach whom
- Accept the per-attachment and per-GB cost versus peering, which has no hourly charge
Why โ Hub-and-spoke scales linearly and gives central routing control, at a price.
Interview tip โ Say peering is still right for two or three VPCs with heavy traffic because it is cheaper and has no throughput cap.
Q17 A developer's Docker bridge network 172.17.0.0/16 collides with the corporate VPN range. How do you fix it?
Intermediate
Situation read โ Docker's default bridge uses 172.17.0.0/16, and anything on the corporate side using that block becomes unreachable from the host.
What I'd do โ
- Change the default address pool in
/etc/docker/daemon.json:{"bip":"172.30.0.1/24","default-address-pools":[{"base":"172.31.0.0/16","size":24}]} - Restart with
sudo systemctl restart docker - Recreate compose networks with
docker compose down && docker compose up -d - Check with
docker network inspect bridgeandip route
Why โ The kernel sees the Docker bridge as a directly connected route that wins over the VPN route.
Interview tip โ Roll the daemon.json change through your laptop or runner image so it never happens twice.
Q18 Traffic from one source IP should leave through ISP B while everything else uses ISP A. How do you do it on Linux?
Intermediate
Situation read โ This is policy-based routing: a rule chooses a routing table based on the packet source.
What I'd do โ
- Add a table in
/etc/iproute2/rt_tables:100 ispb - Add a default route in it:
ip route add default via 203.0.113.1 dev eth1 table ispb - Add the rule:
ip rule add from 10.0.0.50/32 table ispb priority 1000 - Verify with
ip rule showandip route get 8.8.8.8 from 10.0.0.50 iif eth0
Why โ The kernel evaluates rules in priority order and uses the table of the first match, so the main table is only the fallback.
Interview tip โ Mention making it persistent via netplan routing-policy or systemd-networkd.
Q19 Remote engineers should reach only 10.0.0.0/8 through the VPN and use their own internet for everything else. How do you configure that?
Intermediate
Situation read โ This is a split-tunnel design and the details differ per VPN type.
What I'd do โ
- On OpenVPN push specific routes only:
push "route 10.0.0.0 255.0.0.0"and do not pushredirect-gateway def1 - On WireGuard set
AllowedIPs = 10.0.0.0/8in the client peer, not0.0.0.0/0 - Push internal DNS only for internal domains (split DNS)
- Test with
ip route get 8.8.8.8andip route get 10.1.2.3from the client
Why โ AllowedIPs in WireGuard and pushed routes in OpenVPN decide which destinations enter the tunnel.
Interview tip โ Mention the trade-off: split tunnel saves bandwidth but internet traffic is not inspected by corporate security.
Q20 Your team wants to roll out IPv6 in an existing AWS VPC. What is your plan?
Intermediate
Situation read โ Dual-stack is the safe migration path because you keep IPv4 while adding IPv6.
What I'd do โ
- Associate an Amazon-provided /56 with the VPC and a /64 with each subnet
- Add
::/0routes to the IGW (or egress-only IGW for private subnets) - Update security groups and NACLs with
::/0or the correct IPv6 CIDRs - Add AAAA records and test with
curl -6 https://example.com - Roll out per service and watch dual-stack client behaviour (Happy Eyeballs)
Why โ IPv6 addresses are public by default, so private subnets use an egress-only gateway and rules instead of NAT.
Interview tip โ Say security rules are the usual forgotten part: teams add AAAA records but forget the IPv6 rules.
Q21 Design TGW routing for shared services, prod and dev VPCs where prod and dev must never reach each other.
Advanced
Situation read โ Isolation inside a Transit Gateway comes from separate route tables and attachment associations, not from security groups.
What I'd do โ
- Create TGW route tables:
rt-shared,rt-prod,rt-dev - Associate the prod attachment with
rt-prodand dev withrt-dev - Propagate shared-services routes into both, and propagate prod and dev routes only into
rt-shared - Disable default association and propagation on the TGW so new attachments do not land in an open table
- Test with
aws ec2 search-transit-gateway-routesand a ping across the boundary
Why โ The association decides which table an attachment looks up; propagation decides where its prefixes are advertised. Isolation is the absence of a route.
Interview tip โ Mention adding a blackhole route for the other environment as defense in depth.
Q22 Direct Connect is primary and a Site-to-Site VPN is backup. How do you make sure traffic prefers Direct Connect and fails over cleanly?
Advanced
Situation read โ AWS prefers Direct Connect over VPN when prefixes are equal, but you must control it deliberately.
What I'd do โ
- Advertise the same prefixes over both paths
- AWS prefers Direct Connect for equal-length prefixes, so keep both prefixes the same length
- On-prem set higher local preference for the DX learned path and prepend the AS path on the VPN advertisement
- Enable BFD on the DX virtual interface for sub-second failure detection
- Run a failover test during a change window and watch the
ConnectionStatemetric
Why โ A more specific prefix on the backup path would steal traffic, so keep prefixes aligned and control the preference with attributes.
Interview tip โ Say you test failover on a schedule, because untested backup paths fail on the day you need them.
Q23 Two VPN tunnels use ECMP and some flows break after you put a NAT device in the path. What went wrong?
Advanced
Situation read โ ECMP hashing can send packets of one flow on different tunnels, and stateful NAT on one path never sees the other half.
What I'd do โ
- Confirm per-flow load balancing and which tunnel each direction uses with flow logs and
tcpdump - Make the NAT instance a single egress point or give each tunnel its own NAT range
- Prefer active/standby (higher local preference on one tunnel) when state cannot be shared
- If you need ECMP, use Transit Gateway VPN attachments, which support ECMP, and keep NAT out of that path
Why โ Stateful NAT and ECMP only combine safely if all packets of a flow take the same path.
Interview tip โ Show you understand that per-flow hashing is deterministic but is not aware of NAT state.
Q24 The route table has both a static route and a BGP-propagated route to the same prefix. Which wins in a VPC?
Advanced
Situation read โ AWS has a defined route priority order, and getting it wrong creates outages during failover.
What I'd do โ
- Remember the order: local route first, then longest prefix match, then for equal prefixes static routes beat propagated ones
- Among propagated routes, Direct Connect beats VPN static, which beats VPN BGP
- Inspect the effective routes:
aws ec2 describe-route-tables --route-table-ids rtb-0abc --query 'RouteTables[0].Routes' - If a stale static route outlives a migration, delete it
Why โ A forgotten static route pins traffic to a dead path because it outranks propagated BGP routes of equal length.
Interview tip โ Say you audit static routes after every network migration.
Q25 You need to renumber a live /16 VPC that is running out of space without downtime. How do you approach it?
Advanced
Situation read โ You cannot change a VPC primary CIDR, but you can add CIDRs and move workloads onto them.
What I'd do โ
- Associate a secondary CIDR with the VPC and create new subnets in it
- Update route tables, security groups and NACLs to allow the new ranges
- Launch new instances or node groups in the new subnets and shift traffic through the load balancer
- Drain and terminate the old instances, then remove the old subnets
- Keep DNS TTLs low and update any IP-based allow lists in partner systems first
Why โ The VPC is only a container; subnets and instances are what you move, which allows a blue-green style migration.
Interview tip โ Highlight external IP allow lists: partners hardcoding your IPs are what breaks a renumbering.
VPC & Cloud Network Design
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q26 What makes a subnet public versus private in AWS?
Beginner
Situation read โ Subnets have no public/private flag; the difference is entirely the route table and the IP assignment.
What I'd do โ
- Look at the subnet route table: a route
0.0.0.0/0 -> igw-xxxxmakes it public - Check that instances have a public or Elastic IP, otherwise the IGW route is useless for them
- Private subnets send
0.0.0.0/0to a NAT gateway or have no default route at all - Verify with
aws ec2 describe-route-tables --filters Name=association.subnet-id,Values=subnet-0abc
Why โ The internet gateway only does 1:1 NAT for instances that already have a public IPv4 address.
Interview tip โ Say that load balancers and NAT gateways go in public subnets, while application and database tiers stay private.
Q27 Explain internet gateway versus NAT gateway and when you use each.
Beginner
Situation read โ They solve opposite directions of internet access.
What I'd do โ
- Use an IGW for resources with public IPs that must be reachable from and reach the internet (ALB, bastions)
- Use a NAT gateway so private instances can start outbound connections (package updates, API calls) without being reachable inbound
- Place the NAT gateway in a public subnet with an Elastic IP
- Point private route tables
0.0.0.0/0at the NAT gateway
Why โ NAT gateways translate the private source to the NAT's Elastic IP and only allow return traffic for connections initiated from inside.
Interview tip โ Mention NAT gateway cost (hourly plus per GB) because it is a favourite follow-up.
Q28 Private instances need to pull packages from the internet but must not be reachable from it. What do you set up?
Beginner
Situation read โ Standard outbound-only requirement.
What I'd do โ
- Create a NAT gateway in a public subnet with an Elastic IP
- Add
0.0.0.0/0 -> nat-0abcto the private subnet route table - Allow outbound 80/443 in the security group (the default allows all outbound)
- Test from the instance with
curl -sI https://example.com
Why โ Inbound traffic cannot start connections to the private instances because no route or public IP points to them.
Interview tip โ Offer VPC endpoints or a package mirror as the cheaper, more secure alternative.
Q29 Why shouldn't production run in the default VPC?
Beginner
Situation read โ The default VPC is built for convenience, not for controlled production.
What I'd do โ
- List problems: every default subnet is public with auto-assign public IP
- The CIDR is fixed at 172.31.0.0/16 and can clash with other networks
- There is no tier separation or private subnets by default
- Build a custom VPC with Terraform, with explicit public, private and data subnets
- Optionally delete the default VPC in every region with
aws ec2 delete-vpc
Why โ Everything launched there is internet-adjacent by default, which is the opposite of least privilege.
Interview tip โ Mention that you delete or lock down default VPCs in new accounts through SCPs or a baseline stack.
Q30 Public IP, Elastic IP and private IP: how do they differ on EC2?
Beginner
Situation read โ Interviewers check whether you know which survives a stop/start.
What I'd do โ
- Private IP stays with the instance for life in the VPC and is used for internal traffic
- Auto-assigned public IPv4 is released on stop and changes on start
- Elastic IP is a static public address you own until you release it and can remap to another instance or ENI
- Check with
aws ec2 describe-addresses
Why โ Public addressing is a pool resource; only an Elastic IP is stable.
Interview tip โ Mention that idle or unattached Elastic IPs and all public IPv4 addresses are billed now, so you clean them up.
Q31 Why use SSM Session Manager instead of a bastion host?
Beginner
Situation read โ Bastions are a long-lived internet-facing attack surface; SSM removes the open port.
What I'd do โ
- Attach an instance profile with
AmazonSSMManagedInstanceCore - Ensure the instance can reach SSM through NAT or the interface endpoints
ssm,ssmmessages,ec2messages - Connect with
aws ssm start-session --target i-0abc - Enable session logging to S3 or CloudWatch for audit
- Port forward with
aws ssm start-session --document-name AWS-StartPortForwardingSession
Why โ No inbound port 22, no key distribution, and every session is authenticated by IAM and logged.
Interview tip โ Say you still keep a break-glass path documented for when SSM itself is down.
Q32 Your private subnet instances reach S3 through the NAT gateway and the bill is large. What do you do?
Beginner
Situation read โ NAT data processing charges apply to every GB, including traffic that never needs the internet.
What I'd do โ
- Create an S3 gateway endpoint:
aws ec2 create-vpc-endpoint --vpc-id vpc-0abc --service-name com.amazonaws.eu-west-1.s3 --route-table-ids rtb-0abc - The endpoint adds a prefix-list route so S3 traffic bypasses NAT
- Do the same for DynamoDB (also a gateway endpoint)
- Confirm with Cost Explorer or flow logs that NAT bytes drop
Why โ Gateway endpoints are free and keep the traffic on the AWS network.
Interview tip โ Mention restricting the endpoint with an endpoint policy and bucket policy aws:SourceVpce.
Q33 How do you design a highly available 3-tier network in one region?
Intermediate
Situation read โ The interviewer wants AZ redundancy per tier and a clear traffic flow.
What I'd do โ
- Use a VPC with subnets in at least 3 AZs per tier: public (ALB, NAT), private app, private data
- Put one NAT gateway per AZ and route each AZ's private subnet to its own NAT
- Place the ALB across all public subnets and spread ASG instances across private app subnets
- Isolate data subnets with no default route, reachable only from the app security group
- Add flow logs and endpoints for S3, ECR and SSM
Why โ A single NAT gateway is a hidden single point of failure and also adds cross-AZ data charges.
Interview tip โ Draw the picture; interviewers reward seeing the flow ALB to app to DB.
Q34 Gateway endpoint versus interface endpoint: when do you use which?
Intermediate
Situation read โ Both keep traffic off the internet but work very differently.
What I'd do โ
- Gateway endpoints exist only for S3 and DynamoDB and work as route table entries (free)
- Interface endpoints are ENIs with private IPs in your subnets powered by PrivateLink and cost hourly plus per GB
- Interface endpoints are reachable from on-prem over VPN or Direct Connect, gateway endpoints are not
- Enable private DNS so
ssm.eu-west-1.amazonaws.comresolves to the ENI IPs - Secure with a security group allowing 443 from the VPC CIDR
Why โ The gateway type is a routing construct, the interface type is a network interface, which is why only the latter extends to on-prem.
Interview tip โ Mention S3 interface endpoints exist too, for on-prem access to S3 without public IPs.
Q35 Traffic is being rejected somewhere in your VPC. How do you use VPC Flow Logs to find out where?
Intermediate
Situation read โ Flow logs show ACCEPT or REJECT decisions at the ENI level, which separates security group and NACL drops from other issues.
What I'd do โ
- Enable flow logs on the VPC or ENI to CloudWatch Logs or S3
- Query with Athena or CloudWatch Insights for
action = "REJECT"and the target IP and port - Read the line:
2 123456789012 eni-0abc 10.0.1.5 10.0.2.9 51234 5432 6 10 840 1700000000 1700000060 REJECT OK - Check whether the rejection came on the inbound ENI (SG or NACL) and whether the return leg is also rejected (NACL, since SGs are stateful)
Why โ Flow logs record per-ENI decisions, so you can pin the drop to a specific hop.
Interview tip โ Say flow logs do not show payload and are delayed by minutes, so you pair them with tcpdump for deep dives.
Q36 How do you expose a service in one VPC to a customer's VPC without peering?
Intermediate
Situation read โ This is the PrivateLink use case: one-way service exposure without full network connectivity or CIDR coordination.
What I'd do โ
- Put the service behind a Network Load Balancer or Gateway LB
- Create a VPC endpoint service pointing at the NLB and require acceptance
- The consumer creates an interface endpoint to your service name in their VPC
- Allow principals with
aws ec2 modify-vpc-endpoint-service-permissions - Consumer sees a private IP in their subnet and overlapping CIDRs do not matter
Why โ PrivateLink is unidirectional and NATs the connection, so neither side exposes its network.
Interview tip โ Mention that this is how most SaaS vendors offer private access.
Q37 How do you connect VPCs across two AWS accounts and two regions?
Intermediate
Situation read โ Cross-account and cross-region are both supported by peering and TGW with some caveats.
What I'd do โ
- For a few VPCs use inter-region VPC peering: request from one account, accept in the other, add routes on both sides
- For many VPCs use TGW in each region with a TGW peering attachment and static routes (peering does not propagate)
- Share a TGW across accounts with AWS RAM
- Remember inter-region traffic is encrypted on the AWS backbone and billed per GB
Why โ TGW peering routes are static, so you must add both sides explicitly.
Interview tip โ Say you lay out CIDRs globally first because peering across regions amplifies any overlap.
Q38 Your NAT gateway bill jumped. How do you find what is driving it?
Intermediate
Situation read โ Data processing charges scale with bytes, so one chatty workload can dominate.
What I'd do โ
- Check CloudWatch metrics
BytesOutToDestinationandBytesInFromSourcefor the NAT - Enable VPC flow logs on the NAT ENI and query top talkers with Athena grouped by source IP
- Look for container image pulls, S3 or log shipping traffic
- Add gateway endpoints for S3 and DynamoDB and interface endpoints for ECR and CloudWatch
- Consider NAT per AZ to avoid cross-AZ charges
Why โ Most NAT cost is traffic that never needed the internet: AWS service calls.
Interview tip โ Mention that image pulls from ECR over NAT are a classic hidden cost.
Q39 A shared-services team wants to host subnets that other accounts launch into. What do you suggest?
Intermediate
Situation read โ This is VPC sharing with AWS Resource Access Manager.
What I'd do โ
- Share subnets with RAM to the target accounts or OU
- Participants launch resources into the shared subnet but cannot modify the VPC, route tables or subnets
- Control placement and rules with security groups owned by participants
- Use it to cut the number of VPCs, TGW attachments and NAT gateways
Why โ It centralizes network ownership without making every team build and pay for its own network stack.
Interview tip โ Warn that blast radius is shared, so noisy or compromised workloads share IP space and NAT.
Q40 Design egress from private subnets that is stable for partners who allow-list your IPs.
Intermediate
Situation read โ Partners need a small, predictable set of source IPs.
What I'd do โ
- Route private subnets through NAT gateways with Elastic IPs (one per AZ)
- Give the partner the three EIPs and document them
- Consider centralized egress in a dedicated VPC through a TGW so IPs are shared across accounts
- Use
aws ec2 describe-nat-gatewaysto print the current IPs and alert if they change
Why โ Elastic IPs on NAT gateways are static for as long as you keep them, unlike instance public IPs.
Interview tip โ Mention BYOIP if the partner wants IPs your company owns.
Q41 How would you let on-prem users resolve and reach private AWS resources over VPN?
Intermediate
Situation read โ Network reachability alone is not enough; DNS has to cross the VPN too.
What I'd do โ
- Establish Site-to-Site VPN or Direct Connect and propagate routes in both directions
- Create a Route 53 Resolver inbound endpoint in the VPC
- Point on-prem DNS conditional forwarders for
corp.aws.exampleto the inbound endpoint IPs - Test with
dig @10.0.1.10 db.corp.aws.examplefrom on-prem - Open 53 UDP/TCP in security groups
Why โ Private hosted zones are visible only inside VPCs, so on-prem needs the resolver endpoint to ask.
Interview tip โ Mention an outbound endpoint for the reverse direction.
Q42 A security team wants to isolate databases so no instance can reach the internet at all. How?
Intermediate
Situation read โ Combine routing with security controls.
What I'd do โ
- Place databases in subnets whose route table has only the local route
- Remove any NAT or IGW route and use VPC endpoints only for needed services
- Restrict security groups to inbound from the app tier SG ID only and limit outbound
- Add an SCP or config rule that flags public subnets with data tier tags
Why โ Without a route, no packet can leave, regardless of what a security group says.
Interview tip โ Say this is defense in depth: route, SG, NACL and IAM each independently block.
Q43 Design a multi-account landing zone network with centralized inspection and egress.
Advanced
Situation read โ The expected answer is a hub VPC pattern with Transit Gateway and firewalls.
What I'd do โ
- Create an inspection VPC with Gateway Load Balancer endpoints and firewall appliances
- Attach all spoke VPCs to a TGW with appliance mode enabled on the inspection attachment
- Route spoke default routes to TGW, and TGW to inspection, then inspection to a central egress VPC with NAT gateways
- Use separate route tables for spoke, inspection and egress
- Manage with Terraform and AWS Network Firewall rule groups
Why โ Appliance mode keeps both directions of a flow in the same AZ so stateful inspection works.
Interview tip โ Mention that central egress simplifies allow-lists, but TGW data processing cost can be higher than local NAT.
Q44 How do you use Gateway Load Balancer for third-party firewalls and why does it work?
Advanced
Situation read โ GWLB uses GENEVE encapsulation to transparently insert appliances.
What I'd do โ
- Deploy the appliances behind a GWLB (port 6081 GENEVE)
- Create a GWLB endpoint service and endpoints in the protected VPCs
- Route traffic to the GWLB endpoint using route tables (ingress via an edge association)
- The GWLB hashes flows on a 5-tuple so both directions go to one appliance
- Health-check targets on the appliance port
Why โ GWLB combines a transparent bump-in-the-wire with the scaling and health checking of a load balancer.
Interview tip โ Say you pick GWLB when you need a vendor firewall, and AWS Network Firewall when you want managed.
Q45 Two AWS regions must work in active-active. How do you design the network?
Advanced
Situation read โ Think connectivity, traffic steering and failure domains.
What I'd do โ
- Give each region non-overlapping VPC CIDRs and connect with TGW inter-region peering
- Use Route 53 latency or weighted records with health checks, or Global Accelerator for anycast entry
- Keep data replication on private paths (Aurora Global, DynamoDB global tables)
- Make each region self-sufficient for DNS, NAT and endpoints
- Test region evacuation with game days
Why โ Active-active only works if each region can stand alone when the link or the other region fails.
Interview tip โ Mention the egress cost of replication traffic.
Q46 Connect an AWS VPC to a GCP VPC privately. What are your options?
Advanced
Situation read โ Multi-cloud connectivity has a few standard patterns, each with a cost and latency profile.
What I'd do โ
- Site-to-Site VPN with HA VPN on GCP and two tunnels on the AWS side, using BGP
- For more bandwidth use a colocation provider with Direct Connect and Cloud Interconnect cross-connected
- Use a neutral fabric provider (Equinix, Megaport) to avoid managing hardware
- Keep CIDRs unique and run BGP with a clear ASN plan
- Monitor tunnel health and failover
Why โ VPN is fast to set up and encrypted but limited in throughput per tunnel (around 1.25 Gbps on AWS).
Interview tip โ Say you compare cost of egress before deciding to move data across clouds.
Q47 Replace the corporate VPN with a zero-trust model for engineers reaching internal apps.
Advanced
Situation read โ The ask is identity-based access per application instead of network-level access.
What I'd do โ
- Put an identity-aware proxy in front of apps (for example Cloudflare Access, Google IAP, AWS Verified Access)
- Integrate SSO with MFA and device posture
- Remove broad network routes; allow only the proxy to reach apps
- Use short-lived certs or tokens for SSH and databases (for example
teleportor SSM) - Roll out app by app and keep VPN as fallback until usage drops
Why โ Network location no longer implies trust; each request is authenticated and authorized.
Interview tip โ Be honest about migration cost: legacy protocols may need a connector.
Q48 Your NAT gateway shows ErrorPortAllocation. What is happening and how do you scale it?
Advanced
Situation read โ A NAT gateway supports about 55,000 simultaneous connections per destination IP, port and protocol; too many to one endpoint exhausts the ports.
What I'd do โ
- Check CloudWatch
ErrorPortAllocationandActiveConnectionCount - Find the destination causing it with flow logs
- Spread across multiple NAT gateways (one per AZ or per subnet group)
- Attach secondary EIPs to the NAT gateway
- Reduce connection churn with keep-alive and connection pooling in the app
Why โ The limit is per unique destination 3-tuple, so one popular API endpoint is the bottleneck.
Interview tip โ Mention that connection reuse in the client is the cheapest fix.
Q49 How do you design for DDoS resilience at the network edge?
Advanced
Situation read โ Layered defense: absorb at the edge, filter, then scale origin.
What I'd do โ
- Front the app with CloudFront or a CDN and AWS Shield Advanced where justified
- Add AWS WAF rate-based rules and geo or ASN blocks
- Expose only the CDN to the origin (security group with the CloudFront managed prefix list)
- Use Global Accelerator or anycast for non-HTTP traffic
- Autoscale and set up alarms and a runbook with the provider's DRT contact
Why โ Hiding the origin means attackers can only reach what the edge forwards.
Interview tip โ Mention SYN cookies and conntrack limits on origin hosts.
Q50 You operate multiple AWS accounts and need to audit whether any security group is open to 0.0.0.0/0 on SSH. How do you do it at scale?
Advanced
Situation read โ You need continuous detection, not a one-off script.
What I'd do โ
- Enable AWS Config rule
restricted-sshin all accounts via an aggregator - Query with
aws ec2 describe-security-groups --filters Name=ip-permission.from-port,Values=22 Name=ip-permission.cidr,Values=0.0.0.0/0 - Use Security Hub findings and EventBridge to auto-remediate or page
- Block creation with an SCP or Terraform policy check (OPA, Checkov)
Why โ Detective control plus preventive control in CI closes the loop.
Interview tip โ Say remediation by auto-revoking is only safe after teams were warned.
DNS & Service Discovery
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q51 A customer types www.example.com in a browser. Walk through how DNS resolves it.
Beginner
Situation read โ Tests whether you know the resolver hierarchy and caching, not just "DNS turns names into IPs".
What I'd do โ
- Browser and OS check their caches and
/etc/hostsfirst - The stub resolver asks the configured recursive resolver (for example 10.0.0.2 in a VPC or 1.1.1.1)
- On a cache miss the recursive resolver asks a root server, then the
.comTLD servers, then the authoritative nameserver of example.com - The answer returns with a TTL and is cached at every layer
- Watch it with
dig +trace www.example.com
Why โ Each hop only knows who to ask next, and TTLs make the whole system fast and cheap.
Interview tip โ Name the roles: stub, recursive, authoritative.
Q52 What is the difference between an A record and a CNAME, and when do you use each?
Beginner
Situation read โ An A record maps a name to an IP; a CNAME maps a name to another name.
What I'd do โ
- Use A (or AAAA) when you control a fixed IP, for example
app.example.com A 203.0.113.10 - Use CNAME when the target is a name owned by someone else, for example
www CNAME myapp.herokuapp.comor an ALB DNS name - Verify with
dig app.example.comanddig +short CNAME www.example.com - Never put other record types next to a CNAME on the same name
Why โ A CNAME lets the provider change IPs without you touching DNS.
Interview tip โ Mention that a CNAME adds a resolution hop, so it costs one extra lookup on cold cache.
Q53 Why can't you put a CNAME at the zone apex, and what do you use instead?
Beginner
Situation read โ The apex (example.com) must hold SOA and NS records, and a CNAME cannot coexist with other records.
What I'd do โ
- Use a Route 53 ALIAS record to the ALB or CloudFront distribution for
example.com - Other providers call it ANAME or CNAME flattening
- Or use A records pointing to static IPs
- Verify with
dig example.com A +shortand confirm it returns IPs
Why โ ALIAS is resolved by the DNS provider at query time and returned as plain A records, so it is valid at the apex.
Interview tip โ Add that Route 53 ALIAS queries to AWS resources are free.
Q54 You are moving a site to a new server. What do you do with DNS to make the cutover smooth?
Beginner
Situation read โ DNS caching makes cutovers slow unless you prepare.
What I'd do โ
- Lower the TTL (for example from 86400 to 60 seconds) at least one old-TTL period before the change
- Bring the new server up and test it with
curl --resolve www.example.com:443:203.0.113.20 https://www.example.com - Change the record
- Watch both servers' logs until traffic drains from the old one, then raise the TTL again
Why โ Resolvers honor the TTL they cached, so you must wait out the old value before the low TTL takes effect.
Interview tip โ Mention that some ISPs and apps ignore low TTLs, so keep the old server alive for a while.
Q55 How do you find which nameservers are authoritative for a domain and query them directly?
Beginner
Situation read โ Troubleshooting basics with dig.
What I'd do โ
- Run
dig NS example.com +short - Query one directly:
dig @ns1.example.com www.example.comto bypass caches - Compare answers with a public resolver:
dig @1.1.1.1 www.example.com - Look at the
flagsforaa(authoritative answer) - Use
dig +traceto see the delegation chain
Why โ Querying the authority directly separates "the record is wrong" from "a cache has stale data".
Interview tip โ Say that comparing authoritative and recursive answers is your first move for any "DNS is wrong" ticket.
Q56 What DNS records do you set up for company email?
Beginner
Situation read โ MX plus the three email authentication records.
What I'd do โ
- Add MX records pointing to the mail provider with priorities
- Add an SPF TXT:
v=spf1 include:_spf.google.com ~all - Add DKIM as a TXT or CNAME record at
selector._domainkey.example.com - Add DMARC:
_dmarc TXT "v=DMARC1; p=quarantine; rua=mailto:[email protected]" - Check with
dig TXT example.com +shortanddig MX example.com +short
Why โ SPF, DKIM and DMARC together keep your mail out of spam and stop spoofing of your domain.
Interview tip โ Say DMARC should start at p=none with reporting, then move to quarantine and reject.
Q57 When do you use /etc/hosts and when DNS?
Beginner
Situation read โ Hosts file is local, static and overrides DNS for that machine only.
What I'd do โ
- Use
/etc/hostsfor local testing, bootstrapping, or pinning a name before DNS exists - Use DNS for anything shared across hosts
- Order is controlled by
hosts:in/etc/nsswitch.conf(files dns) - Test with
getent hosts myappwhich follows nsswitch rather than only querying DNS
Why โ dig ignores the hosts file, so it can disagree with what applications see; getent shows the application's view.
Interview tip โ Mention that stale hosts entries are a classic cause of "works on my machine".
Q58 Your Kubernetes pods see slow DNS and sometimes SERVFAIL on external names. Where do you look?
Intermediate
Situation read โ Typical CoreDNS issues: ndots, resolver overload, conntrack race on UDP.
What I'd do โ
- Check CoreDNS pods and logs:
kubectl -n kube-system logs deploy/corednsand metrics for latency - Look at the pod
/etc/resolv.conf:options ndots:5meansapi.example.comis tried with 4 search suffixes first - Lower it per pod with
dnsConfig: options: [{name: ndots, value: "2"}]or use fully qualified names ending with a dot - Deploy NodeLocal DNSCache to cut latency and avoid conntrack
- Scale CoreDNS by replicas
Why โ With ndots 5 every external lookup generates several failing queries, multiplying load on CoreDNS.
Interview tip โ Say you check kubectl exec -it pod -- nslookup api.example.com timing before and after.
Q59 What is split-horizon DNS and when do you need it?
Intermediate
Situation read โ The same name returns different answers inside and outside the network.
What I'd do โ
- Create a public hosted zone
example.comwith the public ALB and a private hosted zone with the same name associated to the VPC - Inside the VPC
app.example.comreturns a private IP - Outside it returns the public one
- Verify from an instance with
dig app.example.comand from home with the same command - Be careful: records missing in the private zone become NXDOMAIN inside the VPC
Why โ Private zones shadow the public zone completely for associated VPCs, so every needed record must exist in both.
Interview tip โ Name the failure mode: forgot to copy a record into the private zone.
Q60 How do Route 53 weighted and failover routing differ and when do you use each?
Intermediate
Situation read โ Both are DNS-level traffic policies with different goals.
What I'd do โ
- Weighted: split traffic by weights, for canary releases such as 95/5
- Failover: primary answers while its health check is healthy, otherwise the secondary is returned
- Attach health checks with
aws route53 create-health-check - Set TTL low (30 to 60s) so shifts take effect fast
- Latency and geolocation policies cover regional routing
Why โ DNS routing decisions are cached, so TTL defines how quickly a change reaches clients.
Interview tip โ Mention that DNS failover is coarse and not instant; pair with load balancer health checks.
Q61 A deleted record is still being returned by some users hours later. Why?
Intermediate
Situation read โ Caching at resolvers, and for deleted names negative caching also applies.
What I'd do โ
- Check the record's TTL and the SOA minimum field, which defines negative caching TTL
- Query the authoritative server to confirm the new truth:
dig @ns1.example.com name - Query public resolvers and see their remaining TTL in the answer
- Flush a local resolver:
resolvectl flush-caches - Wait out the TTL or ask the resolver operator to purge (Google and Cloudflare have purge pages)
Why โ Resolvers cache both positive and negative answers for as long as the zone says.
Interview tip โ Say you lower TTL before changes, not after.
Q62 How do you delegate a subdomain to another team's AWS account?
Intermediate
Situation read โ Subdomain delegation lets the owning team manage their zone independently.
What I'd do โ
- In the child account create the hosted zone
dev.example.comand note its four nameservers - In the parent zone add an NS record
dev.example.comwith those four values - Verify with
dig NS dev.example.com +short - Remove the delegation to undo, and never keep conflicting A records for the same name in the parent zone
Why โ NS records at the parent create the delegation; the child zone becomes authoritative.
Interview tip โ Mention this is also how you split blast radius in a large organization.
Q63 Your CI needs to obtain a wildcard TLS certificate from Let's Encrypt. How?
Intermediate
Situation read โ Wildcards require the DNS-01 challenge.
What I'd do โ
- Use certbot or lego with a DNS plugin for Route 53:
certbot certonly --dns-route53 -d '*.example.com' -d example.com - Give the runner a narrowly scoped IAM role allowing
route53:ChangeResourceRecordSetson that zone - The tool creates
_acme-challengeTXT, Let's Encrypt validates it, and the record is deleted - Renew automatically with
certbot renewon a timer
Why โ HTTP-01 cannot prove control of a wildcard; DNS-01 proves control of the whole zone.
Interview tip โ Say you scope the IAM permission to the zone or delegate _acme-challenge via a CNAME to a dedicated zone.
Q64 How do you debug "it resolves for me but not for the customer"?
Intermediate
Situation read โ Likely different resolver, cached data, split horizon or a propagation issue.
What I'd do โ
- Ask the customer for the output of
nslookup nameand the resolver IP they used - Query from several places:
dig @8.8.8.8 name,dig @1.1.1.1 name,dig @<authoritative> name - Compare answers and TTLs
- Check for IPv6 AAAA records without a working IPv6 path
- Check if the customer's network uses DNS filtering or a corporate resolver
Why โ Isolating which resolver gives a different answer tells you whether the zone, the cache or the network is at fault.
Interview tip โ Use online multi-location checkers as a second opinion.
Q65 What are the limits of DNS-based load balancing?
Intermediate
Situation read โ DNS rotation spreads clients roughly but does not know about load or health in real time.
What I'd do โ
- Round-robin returns several A records in rotating order, but clients and resolvers cache them
- Some clients always pick the first record
- With health checks you can remove dead IPs, but only after TTL expiry
- Use a real load balancer or anycast for fine-grained balancing
- Verify with repeated
dig +short name
Why โ DNS balances connection setup at best, and only as fast as caches expire.
Interview tip โ Say DNS is for steering regions, not balancing requests.
Q66 What happens when a service uses a hardcoded IP and the provider changes it, and how do you prevent it?
Intermediate
Situation read โ Pinned IPs in configs and firewall rules break silently when cloud endpoints rotate.
What I'd do โ
- Replace IPs with DNS names in config and resolve at connect time
- For firewall rules use FQDN-based rules (for example Network Firewall domain lists) or provider prefix lists
- Make sure the app respects DNS TTL: JVMs cache DNS forever unless
networkaddress.cache.ttlis set - Alert on connection failures to the old IP
Why โ Cloud load balancers and CDNs change IPs often; the name is the stable contract.
Interview tip โ Mention the JVM DNS cache example; interviewers love it.
Q67 A Route 53 private hosted zone isn't resolving from a second VPC. What do you check?
Intermediate
Situation read โ A private zone only answers for VPCs it is associated with.
What I'd do โ
- Associate the VPC:
aws route53 associate-vpc-with-hosted-zone(cross-account needscreate-vpc-association-authorizationfirst) - Ensure
enableDnsSupportandenableDnsHostnamesare true on the VPC - Test with
dig namefrom an instance and look at the resolver 169.254.169.253 or VPC+2 - Check no overlapping private zone with the same name in another association
Why โ Without association the VPC resolver does not know the zone.
Interview tip โ Mention that cross-account association needs a two-step authorization.
Q68 Your DNS provider has an outage and your site is unreachable. How do you design to survive that?
Advanced
Situation read โ DNS is a global single point of failure unless you plan multi-provider.
What I'd do โ
- Run two authoritative providers (for example Route 53 and NS1 or Cloudflare) and publish both sets of NS records
- Keep zones in sync with
octodnsordnscontrolfrom Git - Keep TTL on NS and critical records reasonable (hours, not seconds) so resolvers keep answers during an outage
- Monitor from outside with synthetic checks against each provider
- Practice a drill
Why โ Resolvers will fall through to the second provider's nameservers if the first stops answering.
Interview tip โ Mention dnscontrol, with zone files as code reviewed through PRs.
Q69 How do you roll out DNSSEC and what can go wrong?
Advanced
Situation read โ DNSSEC signs records so resolvers can validate them, and mistakes cause total outage for validating resolvers.
What I'd do โ
- Enable signing at the DNS provider (Route 53 uses a KMS key in us-east-1)
- Create the DS record at the registrar from the DNSKEY
- Verify with
dig +dnssec example.comanddelv example.com - Pre-lower DS TTL and plan key rollover; monitor expiry of signatures
- If you must roll back, remove the DS record first and wait for its TTL before disabling signing
Why โ A DS record with no matching key makes validating resolvers return SERVFAIL for your whole domain.
Interview tip โ Say the order matters: remove DS before disabling signing.
Q70 Your open resolver is used in a DNS amplification attack. What do you do?
Advanced
Situation read โ Open recursive resolvers answer anyone and amplify small queries into big responses.
What I'd do โ
- Restrict recursion to your networks (BIND
allow-recursion { 10.0.0.0/8; };) - Enable response rate limiting (
rate-limitin BIND options) - Use security groups and firewall rules to allow port 53 only from needed sources
- Check with an external scan, and
dig +short ANYshows large responses - Prefer managed resolvers
Why โ Attackers spoof the victim's IP as the source; the resolver sends big responses at the victim.
Interview tip โ Mention BCP38 egress filtering as the root fix at ISP level.
Q71 How do you choose between DNS, Consul and Kubernetes services for microservice discovery?
Advanced
Situation read โ Each solves discovery at a different level of dynamism.
What I'd do โ
- Use Kubernetes Services and CoreDNS inside a cluster:
svc.namespace.svc.cluster.local - Use Route 53 or an internal DNS for stable cross-cluster entry points
- Use Consul or a service mesh when you need cross-platform discovery (VMs and pods), health-aware routing and mTLS
- Keep the lowest layer that works, because every extra control plane is an outage source
Why โ DNS is simple and universal but slow to change; registries react in seconds but need agents.
Interview tip โ Say you avoid building discovery that platform already provides.
Q72 Design DNS for hybrid multi-VPC, multi-account AWS with on-prem integration.
Advanced
Situation read โ You need a central design so teams don't each create overlapping private zones.
What I'd do โ
- Create a shared-services VPC with Route 53 Resolver inbound and outbound endpoints
- Share resolver rules with RAM to all accounts and associate them with VPCs
- Use private hosted zones per domain, associated to all VPCs that need them
- Forward on-prem domains with outbound rules, and on-prem forwards AWS domains to inbound endpoint IPs
- Log queries with Resolver query logging
Why โ Central resolvers with shared rules avoid per-account sprawl and loops.
Interview tip โ Mention avoiding forwarding loops between on-prem and AWS.
Q73 How do you prevent subdomain takeover from dangling DNS records?
Advanced
Situation read โ A CNAME pointing to a deleted cloud resource can be claimed by an attacker.
What I'd do โ
- Inventory all DNS records through exports from Route 53:
aws route53 list-resource-record-sets --hosted-zone-id Z123 - Scan CNAMEs for NXDOMAIN or provider takeover fingerprints with tools like
subjackornuclei - Make decommission steps delete DNS first
- Put DNS in Terraform so resource and record share a lifecycle
- Alert on new CNAMEs to third-party domains
Why โ The record outlives the resource, and anyone who can claim the target name gets your domain's trust.
Interview tip โ Say DNS belongs in the same pull request as the infrastructure it points to.
Q74 How would you do a DNS-based canary release for a global app, and what are its risks?
Advanced
Situation read โ Weighted DNS records provide a gradual shift but are coarse.
What I'd do โ
- Create two weighted records (for example 99 to the stable ALB and 1 to the canary ALB) with health checks
- Increase weight in steps while watching error rates and latency
- Keep TTL at 30 to 60 seconds
- Know the risk: caching means a client may stay on canary longer, and weights are by DNS query, not by request
- Prefer load-balancer weighted target groups for per-request control
Why โ DNS shifts by resolver query, so low-volume clients may see skewed ratios.
Interview tip โ Say you use DNS for cross-cluster shifts and ALB weights for within-region.
Q75 Why would you use Anycast for DNS or edge services?
Advanced
Situation read โ Anycast announces the same IP from many locations; routing delivers the user to the nearest.
What I'd do โ
- Announce the same prefix from several PoPs via BGP
- Users reach the topologically nearest one, reducing latency
- If a PoP fails, its announcement is withdrawn and traffic moves to the next
- Works well for UDP DNS, and for TCP with care because route changes can break long connections
- Examples: Cloudflare, Route 53, AWS Global Accelerator
Why โ The network, not DNS logic, picks the closest site and handles failure.
Interview tip โ Mention the TCP caveat: route flaps can reset a long-lived connection.
Load Balancing, Proxies & CDN
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q76 What is the difference between a Layer 4 and a Layer 7 load balancer?
Beginner
Situation read โ The layer decides what the balancer can see and therefore what it can route on.
What I'd do โ
- L4 (NLB, HAProxy in
mode tcp) balances on IP and port without reading the payload, so it is fast and protocol agnostic - L7 (ALB, Nginx, Envoy) understands HTTP and can route on host, path, header or cookie
- L7 can terminate TLS, rewrite headers and do WAF or redirects
- Choose L4 for raw TCP/UDP, extreme throughput or static IPs, and L7 for web traffic
Why โ The more of the packet the balancer parses, the smarter and the slower the decision gets.
Interview tip โ Mention that NLB preserves the client source IP, while ALB does not and passes it in X-Forwarded-For.
Q77 When do you choose an ALB and when an NLB in AWS?
Beginner
Situation read โ Different products for different protocols and needs.
What I'd do โ
- ALB for HTTP/HTTPS, path or host routing, gRPC, WebSockets, authentication, WAF integration
- NLB for TCP, UDP or TLS passthrough, static or Elastic IPs per AZ, millions of requests per second, ultra low latency
- Use NLB in front of an ALB if you need static IPs for an HTTP app
- Check with
aws elbv2 describe-load-balancers
Why โ ALB works at layer 7 with rich routing; NLB works at layer 4 with performance and IP guarantees.
Interview tip โ Mention PrivateLink requires an NLB or GWLB, which is a common reason to pick NLB.
Q78 Forward proxy versus reverse proxy: what is the difference?
Beginner
Situation read โ They sit on opposite sides of the connection.
What I'd do โ
- A forward proxy (Squid, corporate proxy) sits in front of clients and controls their outbound access, for example
HTTPS_PROXY=http://proxy:3128 - A reverse proxy (Nginx, Envoy, ALB) sits in front of servers, hiding them and handling TLS, caching and routing
- Test a forward proxy with
curl -x http://proxy:3128 https://example.com - Reverse proxy sits at the public edge of your apps
Why โ A forward proxy represents clients to the world; a reverse proxy represents servers to the world.
Interview tip โ Mention that service meshes are reverse proxies in sidecar form.
Q79 How do health checks work on a load balancer and what makes a good one?
Beginner
Situation read โ A health check decides which targets receive traffic.
What I'd do โ
- The LB probes each target periodically, for example HTTP GET
/healthzevery 10 seconds - A target is marked unhealthy after N consecutive failures and healthy after M successes
- Keep the endpoint cheap and check only what this instance needs (can it serve?), not every downstream
- Configure in AWS with
aws elbv2 modify-target-group --health-check-path /healthz --healthy-threshold-count 2 - Return 200 only after the app is warmed up
Why โ Deep health checks that fail when the database is down can take the entire fleet out at once.
Interview tip โ Say you separate liveness from readiness in Kubernetes for the same reason.
Q80 What are sticky sessions and why would you avoid them?
Beginner
Situation read โ Stickiness pins a client to one backend, usually via a cookie.
What I'd do โ
- ALB stickiness uses
AWSALBcookie, enabled per target group withstickiness.enabled=true - Use only if the app keeps session state in memory
- Better: move session state to Redis or use signed JWTs so any node can serve any request
- Without stickiness, scaling in and rolling deployments are smooth
Why โ Stickiness leads to uneven load and lost sessions when a node dies.
Interview tip โ Say stateless services are the real answer; stickiness is a tactical workaround.
Q81 What does a CDN do and when does it help?
Beginner
Situation read โ A CDN caches content at edge locations close to users.
What I'd do โ
- Static assets (images, JS, CSS, video) are cached at the edge and served without touching the origin
- Cache hits cut latency and origin load
- Set
Cache-Control: public, max-age=31536000, immutableon hashed assets - Dynamic content can still benefit from edge TLS termination and persistent origin connections
- Check with
curl -sI https://cdn.example.com/app.js | grep -i x-cache
Why โ The speed of light is the real bottleneck for global users, and a nearby cache removes the round trip.
Interview tip โ Mention cache keys, since mistakes there cause cache misses or wrong content for other users.
Q82 Your app sees the load balancer's IP instead of the real client IP. How do you get the real one?
Beginner
Situation read โ Proxies replace the source address, so the original goes in a header or the PROXY protocol.
What I'd do โ
- Read
X-Forwarded-For(the left-most is the original client, but only trust entries added by your own proxies) - In Nginx use
set_real_ip_from 10.0.0.0/16; real_ip_header X-Forwarded-For; - On NLB enable client IP preservation or PROXY protocol v2
- Log
$http_x_forwarded_forand verify withcurl -H 'X-Forwarded-For: 1.2.3.4'to confirm spoofing is handled
Why โ A client can send any XFF value, so trust only the hops you control.
Interview tip โ Say that rate limiting and allow lists on a spoofable header are a security bug.
Q83 Round robin versus least connections: when does it matter?
Beginner
Situation read โ Algorithm choice matters when requests have uneven cost.
What I'd do โ
- Round robin is fine when requests are short and equal
- Least connections (
least_connin Nginx,leastconnin HAProxy) is better when requests vary in duration, such as uploads and WebSockets - ALB offers round robin and least outstanding requests
- Switch algorithm and compare p99 latency per backend
Why โ Counting active work spreads load by real effort instead of by turn.
Interview tip โ Mention weighted variants for mixed instance sizes.
Q84 How do you route multiple microservices behind one domain with an ALB?
Intermediate
Situation read โ Path and host based listener rules.
What I'd do โ
- Create one ALB listener on 443 with a default fixed-response or main target group
- Add rules:
/api/*to the api target group,/auth/*to the auth target group,Host: admin.example.comto the admin group - Use
aws elbv2 create-rule --listener-arn <arn> --priority 10 --conditions Field=path-pattern,Values='/api/*' --actions Type=forward,TargetGroupArn=<tg> - Set health checks per target group
- Use IP target type for Kubernetes pods
Why โ One public entry point reduces certificates, DNS records and cost.
Interview tip โ Mention the 100 rules per listener default quota when the service count grows.
Q85 A user reports that long-lived WebSocket connections drop after 60 seconds behind your ALB. What do you change?
Intermediate
Situation read โ The ALB idle timeout default is 60 seconds and WebSocket idle periods hit it.
What I'd do โ
- Raise the ALB idle timeout:
aws elbv2 modify-load-balancer-attributes --load-balancer-arn <arn> --attributes Key=idle_timeout.timeout_seconds,Value=3600 - Send application-level pings every 20 to 30 seconds
- Make sure backend and proxies in between (Nginx
proxy_read_timeout) allow the same duration - Reconnect with backoff on the client
Why โ The weakest timeout in the chain wins; every hop needs a matching value.
Interview tip โ Say the keepalive from the app must be shorter than the LB idle timeout.
Q86 Deployments cause 502 errors for a few seconds behind the load balancer. How do you stop that?
Intermediate
Situation read โ Targets are being removed while requests are in flight, or new targets get traffic before they are ready.
What I'd do โ
- Set the target group deregistration delay (default 300s) to cover your longest request:
aws elbv2 modify-target-group-attributes --attributes Key=deregistration_delay.timeout_seconds,Value=30 - On shutdown handle SIGTERM: stop accepting new work, finish in-flight requests, then exit
- In Kubernetes add a
preStopsleep and a readiness probe - Ensure the app keep-alive timeout is longer than the LB idle timeout to avoid reused connection resets
Why โ 502s on deploy are race conditions between LB state and app lifecycle.
Interview tip โ Mention the keep-alive mismatch as the most common hidden cause.
Q87 How do you do blue/green with weighted target groups on an ALB?
Intermediate
Situation read โ Weighted forwarding lets you shift traffic gradually without DNS changes.
What I'd do โ
- Create two target groups, blue and green
- Set a listener rule action forwarding with weights
blue=100 green=0 - Deploy green, test it through a header-based rule
- Shift 10, 50, 100 percent while watching 5xx and latency
- Roll back by setting the weights back, which is instant
Why โ Weights are enforced per request, so shifts take effect immediately, unlike DNS.
Interview tip โ Mention CodeDeploy or Argo Rollouts can automate these steps.
Q88 Design Nginx as a reverse proxy for two app servers with keepalive, timeouts and a health fallback.
Intermediate
Situation read โ Typical hands-on config question.
What I'd do โ
- Define the upstream:
upstream app { server 10.0.1.10:8080 max_fails=3 fail_timeout=10s; server 10.0.1.11:8080; keepalive 32; } - Proxy:
location / { proxy_pass http://app; proxy_http_version 1.1; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 3s; proxy_read_timeout 30s; } - Validate with
nginx -tand reload withnginx -s reload - Test failover by stopping one backend and watching
access.log
Why โ Upstream keepalive avoids a new TCP handshake per request, and explicit timeouts prevent hung workers.
Interview tip โ Say open source Nginx has only passive health checks.
Q89 Where do you terminate TLS: at the load balancer, at the app, or both?
Intermediate
Situation read โ Trade-off between simplicity, inspection and end-to-end encryption.
What I'd do โ
- Terminate at the ALB or CDN when you want WAF inspection, central cert management (ACM) and lower app complexity
- Use TLS passthrough on NLB when the app must hold the key or you need mTLS end to end
- Re-encrypt to the backend (ALB to HTTPS target group) if compliance requires in-transit encryption inside the VPC
- Use ACM certs for the LB and a private CA for internal hops
Why โ Terminating at the edge lets you inspect traffic; passthrough keeps the key out of the LB.
Interview tip โ Say compliance requirements, not preference, usually decides.
Q90 How do you invalidate a CDN cache after a deployment?
Intermediate
Situation read โ You must clear stale objects or avoid needing to.
What I'd do โ
- Prefer versioned file names (
app.4f3a9c.js) with long TTLs and a short TTL onindex.html - For emergencies invalidate paths:
aws cloudfront create-invalidation --distribution-id E123 --paths '/index.html' '/api/config*' - Watch cost: first 1,000 paths a month are free, then billed
- Verify with
curl -sIand checkX-Cache: Hit from cloudfrontorMiss
Why โ Immutable asset names turn invalidation from a process into a non-event.
Interview tip โ Say you design cache keys so deploys never need a global purge.
Q91 A cross-zone load balancing question: what changes when you enable it on an NLB?
Intermediate
Situation read โ Without cross-zone each LB node only sends traffic to targets in its own AZ.
What I'd do โ
- Without it an AZ with fewer targets gets the same share of traffic as one with many, causing hot spots
- Enable:
aws elbv2 modify-load-balancer-attributes --attributes Key=load_balancing.cross_zone.enabled,Value=true - ALB has it on by default, NLB and GWLB off by default
- Remember cross-AZ data transfer charges apply on NLB when enabled
Why โ Cross-zone evens load but adds inter-AZ cost and a shared failure surface.
Interview tip โ Mention that you keep target counts balanced across AZs when it's off.
Q92 How do you rate-limit abusive clients at the edge?
Intermediate
Situation read โ The limit belongs as close to the attacker as possible.
What I'd do โ
- Use AWS WAF rate-based rules, for example 2000 requests per 5 minutes per IP, on CloudFront or the ALB
- Or Nginx:
limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s;pluslimit_req zone=api burst=20 nodelay; - Return 429 with
Retry-After - Key on API key or user when many clients share NAT IPs
- Monitor blocked counts
Why โ Limits on source IP are crude for mobile carriers and offices behind NAT, so keys matter.
Interview tip โ Say you always start in count mode before blocking.
Q93 Explain how you would load balance gRPC services properly.
Intermediate
Situation read โ gRPC uses long-lived HTTP/2 connections, so connection-level balancing sends all requests from one client to one backend.
What I'd do โ
- Use an L7 balancer that balances per request (ALB supports gRPC, or Envoy)
- In Kubernetes use a headless service with client-side balancing or a mesh such as Istio or Linkerd
- Configure health checks with the gRPC health protocol
- Set max connection age on servers so connections rotate
- Verify distribution by comparing per-pod request counters
Why โ A plain L4 balancer sees one connection and cannot spread the multiplexed requests inside it.
Interview tip โ Mention MAX_CONNECTION_AGE as the hidden hero.
Q94 Compare CloudFront and Global Accelerator for a global application. When do you use each?
Advanced
Situation read โ One is a caching CDN, the other is an anycast network onto the AWS backbone.
What I'd do โ
- CloudFront caches HTTP content at the edge and terminates TLS near users, good for static and cacheable APIs
- Global Accelerator gives two static anycast IPs and routes TCP/UDP over the AWS backbone to the closest healthy regional endpoint, with no caching
- Use GA for non-HTTP protocols, gaming, static IPs and fast regional failover
- Both can be combined for different paths
- Verify with
aws globalaccelerator list-accelerators
Why โ CDN reduces work; accelerator reduces path length and failover time.
Interview tip โ Say you decide by cacheability and protocol.
Q95 A cache stampede hits your origin when a popular object expires. How do you protect the origin?
Advanced
Situation read โ Many edge nodes request the same object simultaneously on a miss.
What I'd do โ
- Enable origin shield (CloudFront) or a regional cache layer to collapse requests
- Use request collapsing and
stale-while-revalidate/stale-if-errorheaders - Add jitter to TTLs so objects don't expire together
- Rate-limit and autoscale the origin
- Pre-warm important URLs after deploy
Why โ Collapsing concurrent misses into one origin fetch turns a thundering herd into a single request.
Interview tip โ Mention stale-if-error as a cheap availability feature.
Q96 You need to design load balancing for 1 million requests per second. What changes?
Advanced
Situation read โ At this scale the balancer itself, connection limits and warm-up matter.
What I'd do โ
- Use NLB or a fleet of Envoy or HAProxy nodes behind anycast or ECMP routing
- Pre-warm ALBs with AWS Support or use many smaller ALBs by service
- Prefer connection reuse and HTTP/2 or HTTP/3 to cut handshakes
- Scale targets across AZs with cross-zone on
- Load test ramps gradually with
k6orvegetaand watch ephemeral port, conntrack and file-descriptor limits
Why โ At extreme scale, the bottleneck is usually state: sockets, conntrack tables and TLS handshakes.
Interview tip โ Say you remove the shared state first and the load balancer second.
Q97 What is the PROXY protocol and when do you need it?
Advanced
Situation read โ It carries the original client address across an L4 hop.
What I'd do โ
- Enable PROXY protocol v2 on the NLB target group:
proxy_protocol_v2.enabled=true - Configure the backend to expect it: Nginx
listen 443 ssl proxy_protocol;withset_real_ip_fromandreal_ip_header proxy_protocol; - Do not enable it on one side only, because the backend then sees garbage in the first bytes and rejects with 400
- Verify with
tcpdump -Aon the first packet
Why โ An L4 balancer cannot add HTTP headers, so the PROXY header is prepended to the TCP stream.
Interview tip โ Say mismatched settings cause immediate protocol errors.
Q98 You must migrate from one load balancer to another with zero downtime. How?
Advanced
Situation read โ Run both in parallel and move traffic with DNS weights.
What I'd do โ
- Build the new LB with identical rules and targets and test with
curl --resolve - Lower the DNS TTL in advance
- Use weighted records to shift 1, 10, 50, 100 percent while watching 5xx and latency
- Keep the old LB for a full TTL after 100 percent
- Update allow lists that contain LB IPs or hostnames
Why โ Parallel run with weighted DNS makes rollback instant at any step.
Interview tip โ Mention that clients with stale DNS keep hitting the old one for TTL, so don't decommission early.
TLS, HTTP & Application Layer
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q99 Explain what happens in a TLS 1.3 handshake in a few sentences.
Beginner
Situation read โ Interviewers want the sequence and what it achieves, not the byte layout.
What I'd do โ
- Client sends ClientHello with supported ciphers, key share and SNI (the hostname)
- Server replies with ServerHello, its key share, certificate and a signed Finished message
- Both derive session keys from the key exchange (ECDHE), so the rest is encrypted
- Client validates the certificate chain, hostname and expiry, then sends Finished
- Inspect with
openssl s_client -connect example.com:443 -servername example.com -tls1_3
Why โ TLS 1.3 needs one round trip and gives forward secrecy by default.
Interview tip โ Mention that TLS 1.2 needs two round trips and TLS 1.3 removed weak ciphers.
Q100 Your site must redirect all HTTP traffic to HTTPS. How do you do it?
Beginner
Situation read โ A simple but common task, with a security extra.
What I'd do โ
- On the ALB add a listener on port 80 with a redirect action to HTTPS 443 and status HTTP_301
- On Nginx use
server { listen 80; return 301 https://$host$request_uri; } - Add HSTS on the HTTPS side:
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; - Test with
curl -sI http://example.com
Why โ A redirect protects the first request; HSTS makes browsers skip HTTP afterward.
Interview tip โ Say you start HSTS with a short max-age before enabling preload.
Q101 What is the difference between 4xx and 5xx errors, and which ones do you see most in networking problems?
Beginner
Situation read โ Client versus server errors, and which of them point at infrastructure.
What I'd do โ
- 4xx means the request is the problem: 400 bad request, 401 and 403 auth, 404 not found, 429 rate limited
- 5xx means the server or path failed: 500 app error, 502 bad gateway (invalid response from upstream), 503 unavailable (no healthy targets or overload), 504 gateway timeout (upstream too slow)
- From the proxy log compare
upstream_statusandstatus - Test the backend directly with
curl -v http://10.0.1.10:8080/health
Why โ 502, 503 and 504 almost always mean the proxy or load balancer cannot get a good answer from its backend.
Interview tip โ Say you map 502 to bad response, 503 to no capacity and 504 to slow response.
Q102 HTTP/1.1, HTTP/2 and HTTP/3: what changed and why does it matter in operations?
Beginner
Situation read โ Each version fixed head-of-line blocking at different layers.
What I'd do โ
- HTTP/1.1 needs multiple connections for parallelism
- HTTP/2 multiplexes streams over one TCP connection with header compression, but one lost packet blocks all streams (TCP head-of-line blocking)
- HTTP/3 runs over QUIC on UDP 443 and avoids that, with faster handshakes
- Test with
curl --http2 -I https://example.comandcurl --http3 -I https://example.com - Ensure firewalls allow UDP 443
Why โ Fewer connections and fewer round trips reduce latency, especially on mobile networks.
Interview tip โ Mention that gRPC requires HTTP/2.
Q103 The browser console shows a CORS error when your frontend calls your API. What is it and how do you fix it?
Beginner
Situation read โ CORS is enforced by the browser, not the network; the API must say which origins may read the response.
What I'd do โ
- Check the error:
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header - Inspect the preflight:
curl -i -X OPTIONS https://api.example.com/v1/items -H 'Origin: https://app.example.com' -H 'Access-Control-Request-Method: POST' - Return
Access-Control-Allow-Origin: https://app.example.com, allowed methods and headers - Make sure the OPTIONS request is not blocked by auth or the gateway
Why โ The server opts in to cross-origin reads with headers; a wildcard with credentials is rejected by browsers.
Interview tip โ Say CORS is not a security control for the API itself.
Q104 How do you check which certificate a server presents and when it expires?
Beginner
Situation read โ Basic operational skill.
What I'd do โ
- Run
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null | openssl x509 -noout -subject -issuer -dates - Check SANs with
-ext subjectAltName - Or use
curl -vI https://example.comand read the TLS section - Alert on
ssl_expirywith Prometheus blackbox exporter
Why โ The -servername flag matters because servers pick a certificate by SNI.
Interview tip โ Mention that checking from outside the network also reveals CDN or LB certificates.
Q105 What is the difference between HTTP keep-alive and a new TCP connection per request?
Beginner
Situation read โ Connection reuse saves handshakes.
What I'd do โ
- A new connection costs a TCP handshake plus TLS handshake, around 2 to 3 round trips
- Keep-alive reuses the connection for many requests
- Configure with Nginx
keepalive_timeout 65;for clients andkeepalive 32;for upstream - Confirm reuse with
curl -vshowingRe-using existing connection
Why โ Connection setup often costs more time than the request itself.
Interview tip โ Say the server's keep-alive timeout should exceed the LB's idle timeout.
Q106 Design mutual TLS between two internal services.
Intermediate
Situation read โ Both sides authenticate with certificates; the hard part is issuance and rotation.
What I'd do โ
- Run an internal CA (Vault PKI, AWS Private CA, or cert-manager with a CA issuer)
- Issue short-lived certs (24 hours) to each workload through a sidecar or SPIFFE
- Configure the server to require client certs: Nginx
ssl_verify_client on; ssl_client_certificate ca.pem; - Test with
curl --cert client.crt --key client.key --cacert ca.crt https://svc:8443 - Prefer a mesh (Istio, Linkerd) to automate it
Why โ Short-lived certs make revocation mostly unnecessary.
Interview tip โ Say manual mTLS fails at rotation time, which is why you automate.
Q107 How do you rotate a TLS certificate without downtime?
Intermediate
Situation read โ Overlap old and new and reload gracefully.
What I'd do โ
- Issue the new certificate before the old one expires, at least 30 days ahead
- Deploy the chain and key in the same file set and reload gracefully:
nginx -t && nginx -s reload - On ALB import or replace the cert in ACM and the listener updates without drop
- Verify with
openssl s_clientfrom outside - Automate with certbot or cert-manager renewals and alert at 14 days
Why โ Graceful reload keeps existing connections alive while new ones use the new cert.
Interview tip โ Mention that forgotten certs on non-HTTP services (SMTP, LDAP) are the usual outage.
Q108 Browsers trust your server but curl and Java clients fail with "unable to get local issuer certificate". What happened?
Intermediate
curl and Java clients fail with "unable to get local issuer certificate". What happened?Situation read โ The server sends only the leaf certificate and browsers fix it by fetching the intermediate.
What I'd do โ
- Check the chain:
openssl s_client -showcerts -connect example.com:443 -servername example.com - Confirm only one certificate is sent
- Configure the server with the full chain: in Nginx
ssl_certificate fullchain.pem; - Re-test with
curl -vand with an SSL checker
Why โ Browsers cache or fetch intermediates (AIA), but most libraries do not.
Interview tip โ Say the leaf must come first and the chain follows in order.
Q109 How do you serve multiple HTTPS domains on one IP?
Intermediate
Situation read โ SNI allows the client to say which hostname it wants during the handshake.
What I'd do โ
- Configure one server block per domain with its own certificate in Nginx
server_name - On an ALB attach multiple certificates to the listener, and it picks by SNI
- Test with
openssl s_client -connect IP:443 -servername a.example.comand again with another name - Use wildcard or SAN certificates to reduce certificate count
Why โ SNI is sent in the ClientHello, before encryption begins.
Interview tip โ Mention that very old clients without SNI get the default certificate.
Q110 Uploads of 5 MB fail with 413 behind your reverse proxy. What do you change?
Intermediate
Situation read โ Proxies enforce body size limits, and each hop has its own.
What I'd do โ
- Nginx: set
client_max_body_size 50m;in thehttp,serverorlocation - Check ingress-nginx annotation
nginx.ingress.kubernetes.io/proxy-body-size: "50m" - Check ALB (1 MB limit for Lambda targets) and WAF body inspection limits
- Test with
curl -F [email protected] https://example.com/upload -v
Why โ The smallest limit in the chain rejects the request, and the error comes from that hop.
Interview tip โ Say you confirm which hop answered by looking at response headers.
Q111 Your proxy retries failed POST requests and customers are charged twice. What do you change?
Intermediate
Situation read โ Retries are only safe for idempotent requests.
What I'd do โ
- Disable automatic retries for non-idempotent methods in the proxy (Nginx
proxy_next_upstream off;or limit toerror timeoutwithnon_idempotentnot set) - In Envoy set
retry_oncarefully and avoid POST - Add idempotency keys in the API so retries are safe
- Log request IDs through every hop to find duplicates
Why โ A timeout does not mean the request failed; the backend may have completed it.
Interview tip โ Say safe retries need idempotency keys, not just luck.
Q112 How do you run Kubernetes certificates automatically with cert-manager?
Intermediate
Situation read โ cert-manager issues and renews certificates as Kubernetes resources.
What I'd do โ
- Install it:
helm install cert-manager jetstack/cert-manager --set crds.enabled=true -n cert-manager --create-namespace - Create a
ClusterIssuerfor Let's Encrypt with HTTP-01 or DNS-01 solvers - Annotate the Ingress with
cert-manager.io/cluster-issuer: letsencryptand settls.secretName - Watch
kubectl get certificate,certificaterequest,order,challenge -A - Alert on
certmanager_certificate_expiration_timestamp_seconds
Why โ The controller renews at two thirds of the lifetime by default, so expiry becomes a monitoring problem rather than a calendar one.
Interview tip โ Say rate limits of Let's Encrypt are why you use staging first.
Q113 What TLS policy do you set on a public load balancer?
Intermediate
Situation read โ Balance security and client compatibility.
What I'd do โ
- Allow TLS 1.2 and 1.3 only and disable TLS 1.0 and 1.1
- On ALB choose a policy such as
ELBSecurityPolicy-TLS13-1-2-2021-06 - Prefer ECDHE ciphers with AES-GCM or ChaCha20
- Scan with
testssl.sh example.comornmap --script ssl-enum-ciphers -p 443 example.com - Check access logs for old TLS versions before tightening
Why โ Dropping old versions removes known attacks, but must be gated on client data.
Interview tip โ Say you measure client TLS versions before changing policy.
Q114 A health check to an HTTPS backend fails after enabling TLS on the app. What do you check?
Intermediate
Situation read โ The load balancer must trust or ignore the backend certificate.
What I'd do โ
- Confirm the health check protocol is HTTPS and the port matches
- Test locally:
curl -vk https://10.0.1.10:8443/health - ALB does not validate the backend certificate, but NLB TLS and Envoy do
- Check the path and expected status code
200-299 - Look at the TargetHealth reason with
aws elbv2 describe-target-health
Why โ A protocol mismatch looks like a timeout or a TLS alert at the LB.
Interview tip โ Say target health reason codes name the failure exactly.
Q115 Design an internal PKI for a microservice platform.
Advanced
Situation read โ Think root protection, issuing CA, automation, revocation and trust distribution.
What I'd do โ
- Keep an offline root CA and an online intermediate in Vault PKI or AWS Private CA
- Issue short-lived workload certs (hours) through SPIFFE/SPIRE or the mesh
- Distribute the root via config management and container base images
- Limit certificate SANs and key usage with roles
- Monitor expirations and CA health, and test CA rotation regularly
Why โ Short lifetimes plus automation beat CRLs and manual renewal.
Interview tip โ Say the intermediate rotation is the test of your design.
Q116 How do you minimize TLS handshake latency for a global application?
Advanced
Situation read โ Cut round trips and cryptographic work.
What I'd do โ
- Enable TLS 1.3 and session resumption
- Terminate TLS at edge locations close to users (CDN)
- Use OCSP stapling so clients don't fetch revocation info
- Use ECDSA certificates, which are cheaper than RSA
- Use HTTP/2 or HTTP/3 and long-lived connections to origin
- Measure with
curl -w '%{time_connect} %{time_appconnect}\n' -so /dev/null https://example.com
Why โ Every round trip costs the full RTT, so the cheapest handshake is the one you skip.
Interview tip โ Mention that 0-RTT in TLS 1.3 has replay risks, so only for idempotent requests.
Q117 Explain HTTP request smuggling and how infrastructure choices affect it.
Advanced
Situation read โ Front-end and back-end disagree about where one request ends.
What I'd do โ
- Understand the cause: conflicting
Content-LengthandTransfer-Encodingheaders parsed differently by proxy and backend - Use the same HTTP stack at both layers or normalize requests at the edge
- Prefer HTTP/2 end to end, and reject ambiguous requests
- Keep proxies, WAF and servers patched
- Test with tools like Burp's HTTP Request Smuggler in a staging environment
Why โ An attacker hides a second request inside the first, which the backend processes with another user's context.
Interview tip โ Say you disable connection reuse between mismatched components as a mitigation.
Q118 You are rolling out HTTP/3 and some users report the site is slower. Why?
Advanced
Situation read โ QUIC runs over UDP, which some networks throttle or block.
What I'd do โ
- Check clients fall back: browsers retry over TCP when QUIC fails, with a delay
- Verify the UDP 443 path in security groups, firewalls and the LB
- Advertise with
Alt-Svc: h3=":443"; ma=86400and watch the share of h3 traffic - Compare real-user metrics by protocol
- If corporate networks block UDP, they will use h2 anyway
Why โ Fallback handles blocking, but the fallback delay and middlebox throttling can hurt.
Interview tip โ Say you roll out h3 gradually and compare RUM data.
Q119 A retry storm takes down a dependency. How do you design the network and client layers to prevent it?
Advanced
Situation read โ Retries multiply load at the moment the service is least able to handle it.
What I'd do โ
- Use exponential backoff with jitter on clients
- Add retry budgets, for example max 10 percent extra requests (Envoy
retry_budget) - Use circuit breakers and outlier detection to eject unhealthy hosts
- Apply timeouts at every hop, shorter at each layer toward the user
- Load shed with 429 or 503 and
Retry-After
Why โ Retries without limits turn a small failure into a self-inflicted outage.
Interview tip โ Say the answer is budgets, not more retries.
Q120 You must rotate the root CA used by every service in a mesh. How do you avoid an outage?
Advanced
Situation read โ Trust must overlap: new CA is trusted before it is used to sign.
What I'd do โ
- Distribute a trust bundle containing both old and new roots to all workloads
- Wait until every workload has the combined bundle
- Switch the issuing CA to the new one and let short-lived certs rotate
- Remove the old root only after its issued certs have expired
- Monitor handshake failures per service, and have a rollback to the old issuer
Why โ Trust first, then issue, then retire; any other order breaks verification.
Interview tip โ Say you rehearse this in staging because CA rotation is rare and scary.
Security: Firewalls, SGs, NACLs & VPN
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q121 Security group versus NACL: explain the differences.
Beginner
Situation read โ One of the most common interview questions; the key is stateful versus stateless.
What I'd do โ
- Security groups attach to ENIs, are stateful, support only allow rules and evaluate all rules together
- NACLs attach to subnets, are stateless, support allow and deny, and evaluate rules in number order
- With a NACL you must allow return traffic yourself, including ephemeral ports 1024-65535
- Use SGs for normal access control and NACLs as a coarse subnet-level backstop or to block a bad IP
- Inspect with
aws ec2 describe-network-acls
Why โ Statefulness means SG return traffic is automatic, while a NACL treats each packet independently.
Interview tip โ Say NACLs are rarely the first tool; you use them for explicit denies.
Q122 How do you let only your office IP SSH into a server?
Beginner
Situation read โ Least privilege on port 22.
What I'd do โ
- Edit the security group inbound rule:
aws ec2 authorize-security-group-ingress --group-id sg-0abc --protocol tcp --port 22 --cidr 203.0.113.7/32 - Remove any
0.0.0.0/0rule for 22 - Better: use SSM Session Manager and close port 22
- Verify from outside with
nc -vz server 22and from another network, which should time out
Why โ A /32 limits access to one address; a timeout from other sources shows the SG is dropping, not rejecting.
Interview tip โ Mention that office IPs change, so a VPN with a fixed egress IP is more stable.
Q123 What does it mean that a security group can reference another security group?
Beginner
Situation read โ Group references make rules follow instances instead of IPs.
What I'd do โ
- Allow the database SG to accept 5432 from the app SG:
--source-group sg-app - Any instance with the app SG may connect, even as IPs change
- It also works across peered VPCs in the same region
- Check rules in the console or
aws ec2 describe-security-group-rules --filters Name=group-id,Values=sg-db
Why โ IP lists rot as autoscaling changes instances, while group membership is always current.
Interview tip โ Say this is how you build tiered access without CIDRs.
Q124 Stateful versus stateless firewalls: what is the practical difference?
Beginner
Situation read โ Do you track connections or evaluate each packet alone?
What I'd do โ
- A stateful firewall remembers outbound connections and automatically allows the replies (security groups,
iptables -m conntrack --ctstate ESTABLISHED,RELATED) - A stateless firewall needs explicit rules both ways (NACLs, router ACLs)
- Stateful devices have connection table limits
- Check with
conntrack -L | wc -landsysctl net.netfilter.nf_conntrack_max
Why โ State lets you write simple rules, at the cost of memory and a table that can fill.
Interview tip โ Say you remember conntrack table exhaustion as the failure mode.
Q125 What is a WAF and where do you place it?
Beginner
Situation read โ It filters HTTP requests for application attacks.
What I'd do โ
- A WAF inspects layer 7 for SQL injection, XSS, bad bots and rate abuse
- Attach AWS WAF to CloudFront, an ALB or API Gateway
- Start with managed rule groups (
AWSManagedRulesCommonRuleSet) in count mode, then block - Review sampled requests and tune false positives
- It does not replace secure code or network controls
Why โ It blocks known bad patterns before they reach your application, but only the patterns it knows.
Interview tip โ Say count mode first, because false positives can take your own app down.
Q126 What is the difference between a site-to-site VPN and a client VPN?
Beginner
Situation read โ One joins networks, the other joins individual users to a network.
What I'd do โ
- Site-to-site connects an office or data center router to a VPC with IPsec tunnels (AWS provides two tunnels per connection)
- Client VPN gives each user an encrypted connection from a laptop (OpenVPN, WireGuard, AWS Client VPN)
- Site-to-site is always-on and routed, client VPN is per user with authentication
- Test with
ip route,pingacross the tunnel andwg showoripsec status
Why โ The first is network to network; the second is device to network.
Interview tip โ Mention both tunnels in site-to-site VPN must be configured for HA.
Q127 How does DNAT or port forwarding work on a Linux gateway?
Beginner
Situation read โ Rewrites the destination address of incoming packets.
What I'd do โ
- Enable forwarding:
sysctl -w net.ipv4.ip_forward=1 - Add the rule:
iptables -t nat -A PREROUTING -p tcp --dport 8080 -j DNAT --to-destination 10.0.1.20:80 - Allow the forwarded traffic:
iptables -A FORWARD -p tcp -d 10.0.1.20 --dport 80 -j ACCEPT - Add MASQUERADE if the return path would not come back through the gateway
- List with
iptables -t nat -L -n -v
Why โ PREROUTING runs before the routing decision, so rewriting there sends the packet to the new host.
Interview tip โ Say nftables is the modern replacement for iptables.
Q128 Why restrict outbound traffic in security groups as well as inbound?
Beginner
Situation read โ Default SGs allow all outbound, which helps attackers after a compromise.
What I'd do โ
- Remove the default allow-all egress rule on sensitive tiers
- Allow only the required destinations, for example 443 to the NAT, 5432 to the database SG
- Use VPC endpoints and prefix lists for AWS services
- Test that the app still works, and watch flow logs for REJECT lines that reveal missing rules
Why โ Egress filtering stops data exfiltration and reverse shells after an app compromise.
Interview tip โ Say it's high value but expensive in effort, so apply it first to data and PCI tiers.
Q129 Your database tier must be reachable only from the app tier. How do you implement it across layers?
Intermediate
Situation read โ Defense in depth: routing, SG, NACL and DB auth.
What I'd do โ
- Put the DB in private subnets without internet routes
- Security group allows 5432 only from the app SG
- Optional NACL allows 5432 from the app subnet CIDRs and ephemeral ports back
- Require TLS and a DB user per application
- Test from an unrelated instance, which must time out, and from the app, which must connect
Why โ Each layer should block on its own so one mistake does not expose the data.
Interview tip โ Say you test the negative case; people only test that the app works.
Q130 A NACL change broke working connections. What commonly goes wrong?
Intermediate
Situation read โ Stateless rules need both directions.
What I'd do โ
- Check inbound rule for the service port and the outbound rule for ephemeral ports 1024-65535 (and vice versa for client connections)
- Check rule numbers: a lower-numbered deny overrides a later allow
- The default NACL allows everything, a custom one denies everything by default
- Use VPC Flow Logs to see REJECT with the NACL's subnet ENI
- Roll back with the last known-good rule set
Why โ NACLs forget connections; reply packets are evaluated as new traffic.
Interview tip โ Say you keep NACLs simple and use SGs for logic.
Q131 You hit "RulesPerSecurityGroupLimitExceeded". What are your options?
Intermediate
Situation read โ Default 60 inbound and 60 outbound rules per SG, and 5 SGs per ENI.
What I'd do โ
- Replace many CIDR rules with a managed prefix list, which counts as one rule by default (
aws ec2 create-managed-prefix-list) - Reference security groups instead of CIDRs
- Split rules across several SGs attached to the same ENI
- Request a quota increase, noting that rules x groups per ENI has a ceiling
- Clean unused rules with an audit script
Why โ Prefix lists collapse hundreds of CIDRs into one reusable object.
Interview tip โ Mention prefix lists are shareable across accounts with RAM.
Q132 Set up WireGuard to give an engineer access to a private network.
Intermediate
Situation read โ WireGuard is a lightweight VPN with a very small config.
What I'd do โ
- On the server install
wireguard-tools, generate keys withwg genkey | tee server.key | wg pubkey > server.pub - Write
/etc/wireguard/wg0.confwith[Interface] Address=10.8.0.1/24 ListenPort=51820 PrivateKey=...and a[Peer]withPublicKeyandAllowedIPs = 10.8.0.2/32 - Enable forwarding and NAT for the private network
- Start with
wg-quick up wg0and checkwg show - Open UDP 51820 in the security group
Why โ AllowedIPs doubles as routing table and access control for each peer.
Interview tip โ Say rotating keys and removing a peer are one-line operations, which is why it's popular.
Q133 Compare OpenVPN, WireGuard and IPsec for different uses.
Intermediate
Situation read โ Different strengths, maturity and operational cost.
What I'd do โ
- IPsec/IKEv2 is the standard for site-to-site between devices from different vendors, and native in clouds
- OpenVPN works over TCP or UDP 443 and passes restrictive firewalls, with certificate-based auth
- WireGuard is the simplest and fastest, UDP only, minimal config
- Choose IPsec for cloud gateways, WireGuard for user or node mesh, and OpenVPN where only 443/TCP is open
- Verify with
openvpn --version,wg --version,ipsec --version
Why โ Pick by interoperability and network constraints, not by benchmark.
Interview tip โ Say WireGuard's small codebase is easier to audit.
Q134 A site-to-site IPsec tunnel is down. How do you troubleshoot?
Intermediate
Situation read โ Phase 1 (IKE) or phase 2 (IPsec) mismatch, NAT-T or routing issue.
What I'd do โ
- Check tunnel status in the AWS console or
aws ec2 describe-vpn-connections --query 'VpnConnections[0].VgwTelemetry' - Compare IKE version, encryption, hash, DH group and lifetimes on both sides
- Verify UDP 500 and 4500 and ESP are not blocked
- On Linux gateways read
ipsec statusalland the logs forNO_PROPOSAL_CHOSENorAUTH_FAILED - Confirm routes and interesting traffic definitions match
Why โ Both sides must agree on parameters exactly or negotiation fails before any traffic flows.
Interview tip โ Say tunnel up with no traffic means routes, not crypto.
Q135 How do you make iptables rules survive a reboot and avoid locking yourself out?
Intermediate
Situation read โ Rules in memory vanish and mistakes on remote hosts cut your session.
What I'd do โ
- Apply rules while keeping an escape:
iptables -A INPUT -p tcp --dport 22 -j ACCEPTbefore setting-P INPUT DROP - Use a timed rollback:
(sleep 120; iptables -F; iptables -P INPUT ACCEPT) &then cancel it once verified - Save with
iptables-save > /etc/iptables/rules.v4andnetfilter-persistent - Prefer nftables or config management
- Keep console access
Why โ Rule order and default policy decide whether you can still log in.
Interview tip โ Say always allow ESTABLISHED,RELATED and SSH first.
Q136 Many SSH brute-force attempts hit a public host. How do you stop them?
Intermediate
Situation read โ Reduce exposure, then rate-limit.
What I'd do โ
- Close the port to the world and use SSM or a VPN
- If SSH must be public, disable passwords in
/etc/ssh/sshd_config:PasswordAuthentication noandPermitRootLogin no - Install fail2ban:
fail2ban-client status sshd - Use security group allow lists
- Review
journalctl -u sshandlastb
Why โ Key-only auth makes brute force pointless, and allow lists remove the noise.
Interview tip โ Say moving SSH to another port is cosmetic, not security.
Q137 You need to allow outbound traffic only to specific domains from a private subnet. How?
Intermediate
Situation read โ Security groups work on IPs and cannot do domain names.
What I'd do โ
- Use AWS Network Firewall with a stateful domain list rule group (allow
.github.com,.amazonaws.com, default deny) - Or a proxy (Squid) allow-listing domains and set
HTTPS_PROXY - Route private subnets through the firewall endpoint
- Look at alert and flow logs for blocked domains and tune
- Note that it inspects SNI, so ECH or domain fronting reduces visibility
Why โ Domain filtering needs a device that reads SNI or Host headers.
Interview tip โ Say you start in alert mode before deny.
Q138 Docker publishes a port and bypasses your ufw rules. Why?
Intermediate
Situation read โ Docker inserts its own iptables rules ahead of ufw's chains.
What I'd do โ
- Understand that
-p 8080:80creates DNAT in the nat table and ACCEPT inDOCKERchain, used before ufw's INPUT rules - Check with
iptables -L DOCKER-USER -n - Add restrictions in the
DOCKER-USERchain:iptables -I DOCKER-USER -i eth0 ! -s 203.0.113.0/24 -j DROP - Or bind to localhost:
-p 127.0.0.1:8080:80 - Use cloud security groups as the real boundary
Why โ Published container ports are forwarded traffic, which doesn't pass through INPUT.
Interview tip โ Say you never rely on host firewalls alone for containers.
Q139 How do you reach private servers over SSH through a bastion in one command?
Intermediate
Situation read โ ProxyJump chains SSH connections transparently.
What I'd do โ
- Use
ssh -J [email protected] [email protected] - Persist in
~/.ssh/config:Host private-*withProxyJump bastion - Use agent forwarding carefully, prefer ProxyJump so keys never touch the bastion
- Port forward a DB:
ssh -L 5432:db.internal:5432 bastion - Audit with SSH logs
Why โ ProxyJump keeps your private key on your laptop.
Interview tip โ Say SSM port forwarding replaces the bastion entirely.
Q140 Design network microsegmentation for a platform with 200 services.
Advanced
Situation read โ Thousands of SG rules can't be hand-managed; you need identity or label based policy.
What I'd do โ
- Use Kubernetes NetworkPolicies with default-deny per namespace, then allow by labels
- Use Cilium or Calico for L3/L4 and L7 policy, and identity-based rules
- Add a mesh for mTLS and authorization policies by service identity
- Outside Kubernetes use SGs referencing SGs per service
- Observe actual flows with Hubble or flow logs before enforcing
- Roll out in audit mode
Why โ Policy by identity survives IP churn; policy by IP does not.
Interview tip โ Say you observe first, enforce second.
Q141 What is your WAF strategy for a public API?
Advanced
Situation read โ Layers of rules with lifecycle management.
What I'd do โ
- Attach WAF at CloudFront or the ALB with managed core, known-bad-inputs and IP reputation groups
- Add rate-based rules by IP and by API key header
- Add custom rules for your path and method patterns, and body size limits
- Log to S3 or Kinesis and analyze with Athena
- Deploy changes through IaC with a count-mode stage and review false positives weekly
Why โ A WAF is a tuned control, not a one-time setting.
Interview tip โ Say bot and API abuse need behavior-based protection beyond signatures.
Q142 How do you stop data exfiltration from compromised workloads?
Advanced
Situation read โ Control egress and detect anomalies.
What I'd do โ
- Default-deny egress with explicit allow lists via security groups, Network Firewall or a proxy
- Force all outbound through a central point with logging
- Use VPC endpoint policies to restrict S3 to your own buckets
- Alert on DNS tunneling patterns using Route 53 Resolver DNS Firewall and query logs
- Use GuardDuty findings for unusual destinations
Why โ Attackers need an outbound path; remove it, and the stolen data has nowhere to go.
Interview tip โ Say DNS is the forgotten exfiltration channel.
Q143 A SYN flood is saturating a public service. How do you respond?
Advanced
Situation read โ SYN flood fills the half-open connection queue.
What I'd do โ
- Verify with
ss -sandnetstat -n | grep -c SYN_RECV - Enable SYN cookies:
sysctl -w net.ipv4.tcp_syncookies=1and raisetcp_max_syn_backlog - Place the service behind a CDN, NLB or Shield Advanced which absorb SYN floods
- Rate-limit at the edge, block sources with NACL or upstream filters
- Engage the provider's DDoS team
Why โ Edge infrastructure has the capacity to absorb it, a single host does not.
Interview tip โ Say host tuning is the last line, not the plan.
Q144 The security team wants a TLS-inspecting proxy for all outbound traffic. What breaks and how do you handle it?
Advanced
Situation read โ Man-in-the-middle inspection needs a trusted CA on every client, and some traffic must be exempt.
What I'd do โ
- Distribute the proxy CA to endpoints, base images and language truststores (Java, Python
certifi, NodeNODE_EXTRA_CA_CERTS) - Exempt certificate-pinned apps, financial or medical sites, and package managers that fail
- Expect errors like
x509: certificate signed by unknown authority - Monitor proxy CPU and latency
- Keep a bypass list under change control
Why โ Each runtime keeps its own trust store, which is why inspection projects stall.
Interview tip โ Say pinned apps and mTLS clients cannot be inspected.
Q145 Explain how you would implement IDS/IPS in a cloud network.
Advanced
Situation read โ Inspection must see traffic; cloud has no span port by default.
What I'd do โ
- Use VPC Traffic Mirroring to send traffic to a Suricata or Zeek fleet behind an NLB for detection
- For inline prevention use Gateway Load Balancer with IPS appliances or AWS Network Firewall (Suricata-compatible rules)
- Tune signatures and keep rules updated
- Forward alerts to the SIEM and tie to automation
- Watch throughput limits and false positives
Why โ Out-of-band detection is safe and scalable; inline prevention gives control but can break traffic.
Interview tip โ Say prevention is only worth it once detection is quiet and tuned.
Kubernetes Networking
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q146 Explain the Kubernetes networking model in one minute.
Beginner
Situation read โ The model has three rules that every CNI must satisfy.
What I'd do โ
- Every pod gets its own IP
- Pods can reach all other pods without NAT, across nodes
- Agents on a node can reach all pods on that node
- Services give a stable virtual IP and DNS name in front of changing pods
- Check with
kubectl get pods -o wideto see pod IPs and nodes
Why โ A flat pod network lets applications use plain ports and IPs without per-host port mapping.
Interview tip โ Say the CNI plugin implements the model; Kubernetes only defines it.
Q147 ClusterIP, NodePort and LoadBalancer: when do you use each?
Beginner
Situation read โ These are the Service types that expose workloads at different scopes.
What I'd do โ
- ClusterIP (default) is internal only, used for service-to-service traffic
- NodePort opens a port (30000-32767) on every node, mostly a building block or for dev
- LoadBalancer asks the cloud to create an external load balancer pointing at the service
- For HTTP apps use one Ingress or Gateway in front of several ClusterIP services
- Check with
kubectl get svc -o wide
Why โ Each type builds on the previous: LoadBalancer includes a NodePort and a ClusterIP.
Interview tip โ Say one LoadBalancer per service gets expensive, so you use Ingress.
Q148 How does a pod find another service by name?
Beginner
Situation read โ CoreDNS gives every Service a DNS name.
What I'd do โ
- The name is
<service>.<namespace>.svc.cluster.local, and within the same namespace<service>is enough - The pod's
/etc/resolv.confpoints to the CoreDNS ClusterIP and has search domains - Test:
kubectl exec -it pod -- nslookup my-svc.prod - Headless services return pod IPs directly
Why โ Search domains in resolv.conf allow short names to expand to the full service FQDN.
Interview tip โ Mention cross-namespace needs at least svc.namespace.
Q149 Service versus Ingress: what is the difference?
Beginner
Situation read โ A Service is L4 load balancing inside the cluster; an Ingress is L7 HTTP routing at the edge.
What I'd do โ
- A Service gives a stable IP and balances across pods
- An Ingress defines host and path rules routed to Services
- An Ingress needs a controller (ingress-nginx, AWS Load Balancer Controller, Traefik) to act
- Check with
kubectl get ingressandkubectl describe ingress app - TLS is configured in
spec.tls
Why โ The Ingress object is only configuration; the controller is the actual proxy.
Interview tip โ Mention Gateway API is the newer, more expressive successor.
Q150 What does a CNI plugin do and which ones do you know?
Beginner
Situation read โ CNI configures pod networking when a pod starts.
What I'd do โ
- Kubelet calls the CNI binary to create the pod's network namespace interface, assign an IP and set routes
- Popular choices: AWS VPC CNI (pod gets a VPC IP), Calico (BGP or VXLAN, network policy), Cilium (eBPF, observability, policy), Flannel (simple overlay)
- Check the config in
/etc/cni/net.d/ - List the plugin pods with
kubectl -n kube-system get pods
Why โ Without a working CNI, nodes stay NotReady and pods remain ContainerCreating.
Interview tip โ Say the choice affects policy support, scale and cloud integration.
Q151 How do you reach a pod from your laptop for debugging without exposing it?
Beginner
Situation read โ kubectl port-forward tunnels through the API server.
What I'd do โ
- Run
kubectl port-forward pod/web-7d4f 8080:80orsvc/web 8080:80 - Open
http://localhost:8080 - It is a debugging tool, not for production traffic
- Use
kubectl execor an ephemeral debug container:kubectl debug -it pod/web --image=nicolaka/netshoot --target=web
Why โ The tunnel uses the API server connection, so no extra network path is needed.
Interview tip โ Say netshoot is your network toolbox in Kubernetes.
Q152 By default, can any pod talk to any other pod, and how do you change that?
Beginner
Situation read โ Kubernetes is open by default; isolation requires NetworkPolicy and a CNI that enforces it.
What I'd do โ
- Without policies all pod-to-pod traffic is allowed
- Create a default-deny:
apiVersion: networking.k8s.io/v1 kind: NetworkPolicy spec: podSelector: {} policyTypes: [Ingress] - Then add allow policies by label
- Check the CNI supports policy (Calico, Cilium; the VPC CNI needs the network policy agent)
- Test with
kubectl execandcurlbetween pods
Why โ A NetworkPolicy object does nothing unless the CNI enforces it.
Interview tip โ Say you remember to allow DNS egress when you add default-deny egress.
Q153 You must expose a web app on the internet with HTTPS on EKS. What components do you wire up?
Intermediate
Situation read โ Typical production path: Ingress controller, certificate, DNS.
What I'd do โ
- Install the AWS Load Balancer Controller with IRSA
- Create an Ingress with
ingressClassName: alband annotationsalb.ingress.kubernetes.io/scheme: internet-facingandtarget-type: ip - Attach an ACM certificate with
alb.ingress.kubernetes.io/certificate-arn - Let ExternalDNS create the Route 53 record
- Verify with
kubectl get ingressandcurl -I https://app.example.com
Why โ IP target type sends traffic directly to pod IPs, skipping node hops.
Interview tip โ Say you pick the controller by what the cloud provides natively.
Q154 Your app needs the real client IP behind a Kubernetes LoadBalancer service. What do you do?
Intermediate
Situation read โ kube-proxy SNATs traffic when it forwards across nodes, hiding the client IP.
What I'd do โ
- Set
externalTrafficPolicy: Localon the Service, which sends traffic only to nodes with local pods and keeps the source IP - The cloud health check then marks nodes without pods unhealthy automatically
- Or use PROXY protocol or
X-Forwarded-Foron an L7 LB - Verify by logging the remote address in the app
- Spread pods across nodes with topology spread constraints
Why โ Cluster policy balances evenly but loses the client IP; Local keeps it with possible imbalance.
Interview tip โ Say the trade-off is uneven load.
Q155 When do you use a headless service?
Intermediate
Situation read โ It returns pod IPs instead of a virtual IP.
What I'd do โ
- Set
clusterIP: Nonein the Service - DNS returns A records for each ready pod, and for StatefulSets stable names like
db-0.db.prod.svc.cluster.local - Use it for databases, Kafka or any client-side discovery
- Check with
nslookup db.prod.svc.cluster.local - Clients must handle multiple records and reconnect on changes
Why โ No virtual IP means no load balancing by kube-proxy; the client sees the real endpoints.
Interview tip โ Say StatefulSets need it for stable network identity.
Q156 Compare kube-proxy iptables mode and IPVS mode.
Intermediate
Situation read โ Both implement Services on each node, with different scaling profiles.
What I'd do โ
- iptables mode creates chains of rules per service and endpoint, evaluated linearly, and updates rewrite large rule sets
- IPVS mode uses kernel hash tables and supports more algorithms (rr, lc, sh) with O(1) lookups at scale
- Check mode:
kubectl -n kube-system get cm kube-proxy -o yaml | grep mode - List with
ipvsadm -Lnoriptables -t nat -L KUBE-SERVICES | head - Cilium can replace kube-proxy with eBPF
Why โ At thousands of services, linear iptables lookups and full rewrites become slow.
Interview tip โ Say you move to IPVS or eBPF once the service count is in the thousands.
Q157 Isolate namespaces so only the frontend namespace can reach the backend namespace on port 8080.
Intermediate
Situation read โ Needs a NetworkPolicy with namespace and pod selectors.
What I'd do โ
- Label namespaces:
kubectl label ns frontend team=frontend - In the backend namespace create a policy:
podSelector: matchLabels: app=api, ingress fromnamespaceSelector: matchLabels: team=frontend, port 8080 - Add a default-deny ingress policy
- Test with
kubectl exec -n frontend deploy/web -- curl -m3 api.backend:8080and from another namespace to confirm timeout
Why โ Network policies are additive allow lists on top of a default deny.
Interview tip โ Say namespaceSelector and podSelector in one from entry are ANDed, in separate entries ORed.
Q158 Your pods need a fixed outbound IP for a partner's allow list. How do you do it?
Intermediate
Situation read โ Pod IPs change and node IPs vary, so egress needs a stable exit.
What I'd do โ
- Route pod egress through NAT gateways with Elastic IPs, which are stable per AZ
- With the VPC CNI custom networking SNAT happens at the node; check
AWS_VPC_K8S_CNI_EXTERNALSNAT - For finer control use an egress gateway (Cilium Egress Gateway, Istio egress gateway) pinned to specific nodes with EIPs
- Provide the partner with the IPs
- Test with
kubectl run -it --rm curl --image=curlimages/curl -- curl -s ifconfig.me
Why โ The source IP the partner sees is whatever NAT sits last in the path.
Interview tip โ Say you verify with an external echo service.
Q159 Why would you add a service mesh and what is the networking cost?
Intermediate
Situation read โ A mesh moves cross-cutting network features into sidecars or node proxies.
What I'd do โ
- Gains: mTLS between services, retries and timeouts, traffic shifting, rich L7 metrics
- Cost: extra proxy hop and CPU or memory per pod, complexity, new failure modes
- Install Istio or Linkerd and enable injection:
kubectl label ns prod istio-injection=enabled - Verify mTLS with
istioctl x describe pod <pod> - Evaluate ambient or eBPF modes to reduce overhead
Why โ A mesh trades compute and operational complexity for uniform security and observability.
Interview tip โ Say you adopt a mesh for a specific problem, not by default.
Q160 Compare Ingress and Gateway API.
Intermediate
Situation read โ Gateway API is the role-oriented successor to Ingress.
What I'd do โ
- Ingress has one resource and relies on controller-specific annotations for most features
- Gateway API separates
GatewayClass,Gateway(infra owner) andHTTPRoute(app owner) - It supports header matching, weighted traffic splitting, TCP and gRPC routes natively
- Check support with
kubectl get gatewayclass - Migrate gradually since both can coexist
Why โ Splitting roles lets platform teams own the listener while app teams own routes.
Interview tip โ Say you choose by controller support and needed features.
Q161 What does hostNetwork: true do and why is it risky?
Intermediate
Situation read โ The pod shares the node's network namespace.
What I'd do โ
- The pod uses the node IP and ports directly, bypassing the pod network
- Used by CNI agents, node exporters and some ingress controllers
- Risks: port conflicts, bypasses NetworkPolicy, can see node traffic
- Check usage with
kubectl get pods -A -o jsonpath='{range .items[?(@.spec.hostNetwork==true)]}{.metadata.name}{"\n"}{end}' - Use admission policy to restrict
Why โ It breaks the isolation boundary that namespaces and policies rely on.
Interview tip โ Say you allow it only for system components.
Q162 How do you automate DNS records for Kubernetes Ingress and Services?
Intermediate
Situation read โ ExternalDNS watches resources and writes DNS records.
What I'd do โ
- Install ExternalDNS with a role limited to the hosted zone
- Annotate the Service or use the Ingress host:
external-dns.alpha.kubernetes.io/hostname: app.example.com - Set
--policy=upsert-onlyand--txt-owner-id=cluster-ato protect existing records - Check
kubectl logs deploy/external-dnsanddig app.example.com - Use a dedicated subdomain zone for the cluster
Why โ Records follow the lifecycle of the Kubernetes objects, preventing stale entries.
Interview tip โ Say TXT ownership records stop two clusters fighting over a name.
Q163 How do you size the pod CIDR and service CIDR for a new cluster?
Intermediate
Situation read โ They are hard to change later and must not overlap with anything reachable.
What I'd do โ
- Estimate max nodes x pods per node, for example 500 nodes x 110 pods needs about 55,000 IPs, so a /16 for pods
- Choose a service CIDR like
10.96.0.0/16that doesn't overlap with VPC, on-prem or peer ranges - With the VPC CNI check subnet capacity instead
- In kubeadm:
--pod-network-cidrand--service-cidr - Record choices in the IPAM
Why โ Overlaps cause unreachable destinations that are very hard to diagnose later.
Interview tip โ Say you plan for growth and keep ranges outside corporate space.
Q164 Cilium replaces kube-proxy in your cluster. What changes and what do you gain?
Advanced
Situation read โ eBPF handles service load balancing in the kernel datapath.
What I'd do โ
- Install with
kubeProxyReplacement=trueand verify withcilium status - Services are translated at socket level or at the TC hook, avoiding iptables and conntrack for service traffic
- Gain: lower latency, better scalability, native Hubble flow visibility and L7 policy
- Risks: kernel version requirements and fewer people who know it
- Validate with
cilium connectivity test
Why โ eBPF maps replace linear rule chains, which scales better and exposes flow-level visibility.
Interview tip โ Say you check kernel version and cloud support before adopting.
Q165 How do you connect services across two Kubernetes clusters?
Advanced
Situation read โ Options range from simple DNS to full multi-cluster meshes.
What I'd do โ
- Simple: expose services through internal load balancers and private DNS names
- Network-level: non-overlapping pod CIDRs plus routing (TGW, peering) or Cilium Cluster Mesh
- Service-level: Istio multi-cluster or the Multi-Cluster Services API (
ServiceExport) - Keep identity consistent with shared root CA
- Test failover by killing a cluster's endpoints
Why โ Cross-cluster calls multiply failure modes, so start with the simplest path that meets the requirement.
Interview tip โ Say overlapping pod CIDRs are why you plan before the first cluster.
Q166 A cluster with 10,000 Services has slow network programming and high CPU in kube-proxy. What do you do?
Advanced
Situation read โ iptables mode does not scale linearly.
What I'd do โ
- Confirm with
iptables-save | wc -land kube-proxy sync duration metrics - Switch to IPVS or eBPF replacement
- Reduce services through consolidation with Ingress
- Use EndpointSlices (default) and avoid churn from flapping readiness
- Tune
conntracksizes
Why โ The cost is per rule, and Services times endpoints grows fast.
Interview tip โ Say endpoint churn is as important as raw counts.
Q167 Pods with the AWS VPC CNI take long to start and sometimes stay in ContainerCreating with "failed to assign an IP address". What is the design fix?
Advanced
Situation read โ IP warm pool or subnet exhaustion.
What I'd do โ
- Check
kubectl logs -n kube-system ds/aws-nodeandipamdmessages - Verify subnet free IPs and ENI limits per instance type
- Enable prefix delegation to get /28 prefixes per ENI
- Tune
WARM_IP_TARGET,MINIMUM_IP_TARGET - Use custom networking with secondary CIDR
- Choose instance types with more ENIs or use Karpenter with right sizing
Why โ Each instance type caps ENIs and IPs per ENI, so density and subnet size both limit pods.
Interview tip โ Say max pods formula depends on instance type unless prefix delegation is enabled.
Q168 How do you roll out Ingress controller upgrades with zero downtime?
Advanced
Situation read โ The Ingress controller is your data plane; treat it like production infrastructure.
What I'd do โ
- Run at least 3 replicas across AZs with a PodDisruptionBudget
- Use
maxUnavailable: 0rolling updates and readiness probes - Add
preStopsleep and graceful shutdown so connections drain - Test the new version on a second ingress class and shift via DNS or weighted ALB
- Watch 5xx and latency during the rollout
Why โ Connection draining and surge capacity keep in-flight requests alive.
Interview tip โ Say canary the controller itself, not just the apps behind it.
Q169 Design pod egress with centralized inspection and per-team allow lists.
Advanced
Situation read โ You need identity-aware egress per namespace.
What I'd do โ
- Use Cilium egress gateway or Istio egress gateway with per-namespace policies
- Enforce FQDN policies using CiliumNetworkPolicy
toFQDNs - Route egress through a central NAT and firewall with logging
- Give each team a policy through GitOps pull requests
- Alert on denied flows with Hubble
Why โ Pod IPs are ephemeral, so egress rules must follow labels and names, not addresses.
Interview tip โ Say audit logs of denied flows drive onboarding of new destinations.
Performance, MTU, Latency & Tools
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q170 Latency, bandwidth and throughput: what is the difference and why does it matter?
Beginner
Situation read โ People mix these up and then buy bandwidth to fix a latency problem.
What I'd do โ
- Latency is the time for a packet to travel (RTT in ms)
- Bandwidth is the link capacity (Mbps or Gbps)
- Throughput is what you actually achieve, limited by latency, window size, loss and CPU
- Measure RTT with
ping -c 10 hostand throughput withiperf3 -c host - A 1 Gbps link with 200 ms RTT still gives slow single-stream transfers
Why โ TCP needs acknowledgements, so high RTT caps throughput regardless of link speed.
Interview tip โ Say the formula: throughput is at most window size divided by RTT.
Q171 When do you use ping, traceroute and mtr?
Beginner
Situation read โ Each answers a different question.
What I'd do โ
pingtests reachability and RTT to one hosttraceroute -n host(ortracepath) shows each hop to find where the path breaks or slowsmtr -rwzc 100 hostcombines both over time, showing loss and latency per hop- Remember many routers deprioritize ICMP, so loss on a middle hop that doesn't continue to the end is usually noise
Why โ Only loss that carries through to the final hop is real loss.
Interview tip โ Say you read mtr from the last hop backward.
Q172 What is MTU and what is the usual value?
Beginner
Situation read โ The maximum packet size without fragmentation on a link.
What I'd do โ
- Standard Ethernet MTU is 1500 bytes
- AWS supports 9001 inside a VPC (jumbo frames), but 1500 over the internet and VPN
- Overlays and tunnels reduce it (VXLAN loses 50 bytes, WireGuard about 60-80)
- Check with
ip link show eth0and test withping -M do -s 1472 host
Why โ If packets exceed the MTU along the path, they're fragmented or dropped.
Interview tip โ Mention 1472 plus 28 bytes of headers equals 1500.
Q173 How do you check what is listening on a port and who is connected?
Beginner
Situation read โ Everyday server diagnosis.
What I'd do โ
ss -tulpnlists listening TCP and UDP sockets with process namesss -tn state established '( dport = :443 )'shows active connectionslsof -i :8080shows the owning process- From another host use
nc -zv host 8080orcurl -v telnet://host:8080 netstatis deprecated in favour ofss
Why โ ss reads kernel socket tables directly and is faster than netstat.
Interview tip โ Say listening on 127.0.0.1 versus 0.0.0.0 is the first thing to read.
Q174 How do you measure where time goes in a slow HTTP request?
Beginner
Situation read โ Break the request into DNS, connect, TLS, first byte and transfer.
What I'd do โ
- Run
curl -o /dev/null -s -w 'dns=%{time_namelookup} connect=%{time_connect} tls=%{time_appconnect} ttfb=%{time_starttransfer} total=%{time_total}\n' https://example.com - High dns means resolver trouble
- High connect means network path or SYN drops
- High tls means handshake cost
- High ttfb minus tls means the backend is slow
Why โ Each phase points to a different layer and a different owner.
Interview tip โ Say you keep a curl format file for this in your toolkit.
Q175 What does tcpdump do and what are the first filters you use?
Beginner
Situation read โ Packet capture is the final source of truth.
What I'd do โ
- Capture on an interface:
sudo tcpdump -ni eth0 host 10.0.1.5 and port 443 - Save for Wireshark:
sudo tcpdump -ni any -w /tmp/cap.pcap -c 10000 - Show only SYN packets:
tcpdump -ni eth0 'tcp[tcpflags] & tcp-syn != 0' - Use
-nnto skip DNS and port name lookups - Keep captures short and filtered
Why โ Capturing at the host proves whether a packet really arrived or left.
Interview tip โ Say you capture on both ends to prove where a packet disappears.
Q176 TCP or UDP: how do you choose for an application?
Beginner
Situation read โ Reliability and ordering versus latency and overhead.
What I'd do โ
- TCP gives ordered, reliable delivery with congestion control, good for web, databases, APIs
- UDP has no handshake or retransmit, good for DNS, real-time media, gaming and QUIC (which builds reliability on top)
- Test UDP reachability with
nc -u -vz host 53 - Open the correct protocol in security groups, since TCP rules don't cover UDP
Why โ TCP trades latency for guarantees; UDP leaves reliability to the application.
Interview tip โ Say HTTP/3 is reliable but runs on UDP through QUIC.
Q177 What does the TCP three-way handshake look like in a capture?
Beginner
Situation read โ Reading SYN, SYN-ACK, ACK in tcpdump helps spot where a connection fails.
What I'd do โ
- Client sends SYN, server returns SYN-ACK, client sends ACK
- In tcpdump look for flags
[S],[S.],[.] - Only
[S]repeated means packets are dropped or the server is unreachable [R.]after[S]means the port is closed- Capture with
tcpdump -ni eth0 'host 10.0.1.5 and tcp port 22'
Why โ The pattern of flags tells you whether the problem is a drop, a reject or an application issue.
Interview tip โ Say repeated SYN means firewall drop; RST means closed port.
Q178 Large uploads over your VPN hang while small requests work. What is likely going on?
Intermediate
Situation read โ Classic path MTU problem: tunnel overhead reduces effective MTU and ICMP is filtered.
What I'd do โ
- Test:
ping -M do -s 1400 hostand reduce size until it passes, finding the real path MTU - Check
tracepath hostforpmtu - Clamp MSS on the tunnel:
iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu - Set interface MTU explicitly, for example 1380 on WireGuard
- Allow ICMP type 3 code 4 in firewalls
Why โ Large packets with DF set are dropped silently when ICMP "fragmentation needed" messages are blocked.
Interview tip โ Say "small works, big hangs" is the signature of MTU.
Q179 When do you use jumbo frames and what are the risks?
Intermediate
Situation read โ Jumbo frames cut per-packet overhead but need the whole path to support them.
What I'd do โ
- Use 9001 MTU within an AWS VPC and cluster placement groups for storage, HPC or heavy replication
- Set it with
sudo ip link set dev eth0 mtu 9001 - Remember traffic leaving the VPC, over VPN or between regions is limited to 1500 (or 8500 over TGW)
- Test each path with
ping -M do -s 8973 host - Mismatched MTU yields drops
Why โ Jumbo only helps if every hop supports it; otherwise path MTU discovery or drops follow.
Interview tip โ Say you validate end to end rather than assuming.
Q180 How do you measure real network bandwidth between two servers?
Intermediate
Situation read โ Use a synthetic test with controlled parameters.
What I'd do โ
- Start a server:
iperf3 -s - Run the client:
iperf3 -c 10.0.1.20 -P 4 -t 30(4 parallel streams) - Add
-Rfor reverse direction and-u -b 500Mfor UDP - Compare with the instance type's baseline and burst network limits
- Test across AZs and regions separately
Why โ A single TCP stream is limited by window and RTT, parallel streams reveal the pipe capacity.
Interview tip โ Say cloud instance types have bandwidth caps and burst credits.
Q181 Why does a transfer across regions seem slow even with plenty of bandwidth?
Intermediate
Situation read โ Bandwidth-delay product: long RTT needs a large TCP window.
What I'd do โ
- Measure RTT, for example 180 ms, and target 1 Gbps: BDP is about 22 MB
- Check window scaling:
sysctl net.ipv4.tcp_window_scalingand buffersnet.ipv4.tcp_rmemandtcp_wmem - Increase max buffers:
sysctl -w net.core.rmem_max=33554432 - Use parallel streams, or multipart S3 upload
- Consider BBR:
sysctl -w net.ipv4.tcp_congestion_control=bbr
Why โ A sender can have only a window of unacknowledged data in flight; small windows waste a long pipe.
Interview tip โ Say BDP equals bandwidth times RTT.
Q182 mtr shows 40% loss at hop 5 but 0% at the destination. Is there a problem?
Intermediate
Situation read โ Probably not; routers rate-limit ICMP replies.
What I'd do โ
- Look at the last hop first: 0% there means end-to-end delivery is fine
- Loss that persists on all following hops is real
- Verify with application-level tests:
curltimings andiperf3 -ufor loss - Run
mtr -T -P 443 hostto probe with TCP instead of ICMP - Check
ss -tiretransmit counters on the endpoint
Why โ Intermediate routers deprioritize replies to probes, but forward real traffic normally.
Interview tip โ Say evidence comes from the endpoints, not from a mid-path router.
Q183 How do you spot TCP retransmissions and what do they tell you?
Intermediate
Situation read โ Retransmits show packet loss or congestion.
What I'd do โ
- Per host counters:
nstat -az TcpRetransSegsornetstat -s | grep -i retrans - Per connection:
ss -ti dst 10.0.1.20and readretrans:andrtt: - In Wireshark filter
tcp.analysis.retransmission - Rate of retransmits above about 1% is worth investigating
- Correlate with interface drops:
ip -s link show eth0andethtool -S eth0
Why โ Retransmits are TCP telling you the network lost or delayed its packets.
Interview tip โ Say you check NIC drops and queue overruns before blaming the network.
Q184 Your server shows thousands of sockets in TIME_WAIT. Is that a problem?
Intermediate
Situation read โ Usually not, unless it exhausts ephemeral ports on a client.
What I'd do โ
- Count states:
ss -sandss -tan state time-wait | wc -l - TIME_WAIT lasts 60 seconds on Linux and protects against late packets
- The real problem is port exhaustion on a client making many outbound connections to one destination
- Widen the range:
sysctl -w net.ipv4.ip_local_port_range="10240 65535" - Use keep-alive and connection pooling instead of tweaking
tcp_tw_reuse
Why โ TIME_WAIT is a feature, and fewer short connections is the actual fix.
Interview tip โ Say never enable the removed tcp_tw_recycle.
Q185 How do you simulate latency and packet loss to test application behavior?
Intermediate
Situation read โ Chaos testing at the network layer.
What I'd do โ
- Use
tc netem:sudo tc qdisc add dev eth0 root netem delay 100ms 20ms loss 1% - Verify with
pingandtc qdisc show dev eth0 - Remove with
sudo tc qdisc del dev eth0 root - Use toxiproxy or Chaos Mesh for containers and Kubernetes
- Run tests against timeouts and retry settings
Why โ Applications that look fine on a LAN often fail under 100 ms RTT or 1% loss.
Interview tip โ Say you test timeouts, not only throughput.
Q186 How do you capture traffic from a Kubernetes pod without changing the image?
Intermediate
Situation read โ Use an ephemeral debug container sharing the pod's network namespace.
What I'd do โ
- Run
kubectl debug -it pod/web --image=nicolaka/netshoot --target=web -- bash - Inside run
tcpdump -ni eth0 port 8080 -w /tmp/c.pcap - Copy out with
kubectl cp web:/tmp/c.pcap ./c.pcap -c debugger-xyz - Alternatively use
kubectl sniff(krew plugin) to stream into Wireshark - Capture on the node with
tcpdump -i anyto see the CNI path
Why โ A shared network namespace gives full visibility without modifying the application image.
Interview tip โ Say production images shouldn't carry tcpdump.
Q187 How do you monitor network health continuously?
Intermediate
Situation read โ Combine active probes and passive metrics.
What I'd do โ
- Run Prometheus blackbox exporter for HTTP, TCP, ICMP and DNS probes from several locations
- Collect node metrics (
node_network_receive_errs_total,node_netstat_Tcp_RetransSegs, conntrack usage) - Enable VPC flow logs and ELB access logs for analysis
- Alert on error rate, latency p99 and certificate expiry
- Track SLOs for DNS and connection success
Why โ Probes show what users experience; host metrics show why.
Interview tip โ Say you probe from outside your own network.
Q188 Why does cross-AZ traffic matter for cost and latency?
Intermediate
Situation read โ AZs are separate data centers in a region with small latency and per-GB charges.
What I'd do โ
- Latency within an AZ is typically under 1 ms, cross-AZ about 1 to 2 ms
- AWS charges for data transferred between AZs in both directions
- Keep chatty paths (app to cache) in the same AZ with topology-aware routing
- In Kubernetes use
topology.kubernetes.io/zoneand topology aware routing on Services - Check cost with Cost Explorer filtered to
DataTransfer-Regional-Bytes
Why โ Spreading for availability is right, but chatty cross-AZ calls cost money and latency.
Interview tip โ Say you balance availability against locality deliberately.
Q189 Your conntrack table is full: "nf_conntrack: table full, dropping packet". What do you do?
Intermediate
Situation read โ The kernel tracks every flow and drops new ones at the limit.
What I'd do โ
- Check usage:
sysctl net.netfilter.nf_conntrack_count net.netfilter.nf_conntrack_max - Raise:
sysctl -w net.netfilter.nf_conntrack_max=1048576and the hash size - Lower timeouts for idle states like
nf_conntrack_tcp_timeout_time_wait - Reduce flows with keep-alive and pooling
- Exempt high-volume traffic from tracking with
iptables -t raw -j NOTRACK
Why โ Each tracked flow uses memory, and a busy NAT or Kubernetes node hits the cap sooner than expected.
Interview tip โ Say you alert on conntrack usage above 80 percent.
Q190 Users report intermittent slowness only in the evening. How do you hunt for microbursts and congestion?
Advanced
Situation read โ Averages hide bursts shorter than the monitoring interval.
What I'd do โ
- Look at fine-grained metrics: interface drops and
tc -s qdisc show dev eth0backlog, andethtool -S eth0forrx_missedortx_dropped - Use one-second sampling (
sar -n DEV 1) rather than minute averages - Check instance bandwidth allowance exceeded with
ethtool -S eth0 | grep allowance_exceededon AWS ENA - Compare with flow logs to find talkers
- Add capacity or shape traffic
Why โ A link can be 20 percent utilized on average and still drop packets in 50 ms bursts.
Interview tip โ Say ENA allowance counters are the AWS-specific hint.
Q191 Tune a Linux server to handle 100,000 concurrent connections.
Advanced
Situation read โ Think file descriptors, kernel buffers and the accept queue.
What I'd do โ
- Raise limits:
ulimit -n 1048576andfs.file-max - Tune the accept queue:
net.core.somaxconn=65535andnet.ipv4.tcp_max_syn_backlog=65535 - Widen ports and enable
tcp_syncookies - Set
net.core.netdev_max_backlog, use multi-queue NICs and RSS/RPS for CPU spread - Use epoll-based servers (Nginx, Envoy)
- Verify with
wrkork6while watchingss -s
Why โ Each connection costs memory and a descriptor; the defaults assume far lower scale.
Interview tip โ Say you measure after every change, not guess.
Q192 How do you find the cause of a request that is slow only 1 in 1000 times?
Advanced
Situation read โ Tail latency usually comes from retransmits, DNS timeouts or GC, not average load.
What I'd do โ
- Add timing breakdown to logs (connect, TLS, TTFB) and trace IDs
- Check for 1 second or 3 second multiples (TCP SYN retransmit at 1s, DNS timeout at 5s)
- Capture with tcpdump around the slow event
- Use
bpftraceortcpretransfrom bcc to log retransmits live - Correlate with GC pauses and noisy neighbours
Why โ Delays in exact multiples of the retransmit or resolver timeouts are a fingerprint.
Interview tip โ Say 1s, 3s and 5s latencies point at network timeouts, not CPU.
Q193 UDP-based real-time service (voice, game) is chosen. How do you handle loss, jitter and NAT?
Advanced
Situation read โ No retransmission means the application manages quality.
What I'd do โ
- Use RTP or QUIC with forward error correction and jitter buffers
- Prefer anycast or regional edge so RTT stays low
- Handle NAT traversal with STUN, TURN and ICE for peer paths
- Mark DSCP values (EF for voice) where networks honour them
- Open UDP port ranges and set NLB UDP health checks properly
- Monitor jitter and loss with probe tools
Why โ Real-time media prefers a late-lost packet over a delayed one, so the app tolerates loss.
Interview tip โ Say TURN relays cost bandwidth and are the fallback.
Q194 Trace network behavior at scale in Kubernetes without sampling gaps. What do you use?
Advanced
Situation read โ eBPF-based observability sees every flow with low overhead.
What I'd do โ
- Deploy Cilium with Hubble:
hubble observe --namespace prod --verdict DROPPED - View service dependency maps in Hubble UI
- Export flow metrics to Prometheus
- Use
bpftraceone-liners for node-level debugging liketcpretrans - Retain flow logs for forensics
- Compare with the policies in git to find mismatches
Why โ Kernel-level hooks see flows regardless of application instrumentation.
Interview tip โ Say Hubble answers "why was this dropped" with a policy name.
Network Operations & Change Management
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q195 How do you roll out a security group or firewall change in production safely?
Intermediate
Situation read โ Network changes can take down everything at once and are often hard to see failing.
What I'd do โ
- Express the change as code and review it as a pull request showing
terraform planoutput - Add the new allow rule first, verify traffic, then remove the old rule
- Apply in a change window with a rollback command ready (
git revertand re-apply) - Watch flow logs REJECT counts and application error rate during and after
- Announce in the incident or change channel
Why โ Adding before removing keeps both paths working, so mistakes show up before an outage.
Interview tip โ Say you never delete a rule you haven't seen unused in flow logs.
Q196 How do you manage VPCs and network resources with Terraform without drift or accidents?
Intermediate
Situation read โ Shared network code has a large blast radius.
What I'd do โ
- Keep network in its own state, with remote backend and locking (S3 plus DynamoDB or native S3 locking)
- Use a reviewed module for VPC, subnets and routes with
cidrsubnet - Add
prevent_destroyon VPCs and TGWs - Run
terraform planon a schedule to detect drift - Restrict who can apply via CI roles
Why โ A small, isolated state limits what one bad apply can destroy.
Interview tip โ Say you separate network from application stacks for blast radius reasons.
Q197 A route table was changed by mistake and production lost internet access. How do you recover and learn?
Intermediate
Situation read โ First restore, then find the cause.
What I'd do โ
- Find the change:
aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=ReplaceRoute - Restore the route (
aws ec2 create-route --route-table-id rtb-0abc --destination-cidr-block 0.0.0.0/0 --nat-gateway-id nat-0abc) - Verify from an instance with
curl -sI https://example.com - Reconcile with Terraform to remove drift
- Write a post-incident review and restrict console edits with SCPs or IAM
Why โ CloudTrail records who changed what and when, which makes rollback exact.
Interview tip โ Say manual console fixes must be backported to code immediately.
Q198 Data transfer charges are 30% of the AWS bill. How do you reduce them?
Intermediate
Situation read โ The costs come from a few patterns: NAT, cross-AZ, cross-region and internet egress.
What I'd do โ
- Break down with Cost Explorer grouped by usage type, and flow logs for top talkers
- Add gateway and interface endpoints to bypass NAT
- Keep chatty services in one AZ or use topology aware routing
- Put a CDN in front of public egress, which is often cheaper per GB
- Compress, cache and use private links between regions only when needed
Why โ Know which of the four categories is the bill before changing anything.
Interview tip โ Say measure first; most savings come from one or two top flows.
Q199 What is your checklist for onboarding a new office to your cloud network over VPN?
Intermediate
Situation read โ It's a repeatable process that should be a template.
What I'd do โ
- Allocate a unique CIDR from IPAM, no overlap with existing sites
- Create the customer gateway, VPN connection and two tunnels, with BGP where possible
- Add routes to the VPC or TGW route tables and security rules for the office CIDR
- Configure split DNS to private zones
- Test with ping, traceroute, DNS and an application, then monitor tunnel state and set alarms
Why โ A template avoids snowflake configurations and forgotten steps such as DNS.
Interview tip โ Say you document the tunnel parameters, because the other side's config is rarely in your repo.
Q200 Design network disaster recovery for the loss of an entire region.
Advanced
Situation read โ It covers entry traffic, data and connectivity, and it must be tested.
What I'd do โ
- Pre-build a standby VPC and infrastructure in a second region with non-overlapping CIDRs, connected by TGW peering
- Use Route 53 health checks with failover records or Global Accelerator to move users
- Replicate data with cross-region replication
- Keep DNS, certificates and secrets available in both regions
- Define RTO and RPO per service and run game-day failover tests twice a year
Why โ An untested failover plan is a hypothesis; the dependency you forgot shows up during the real event.
Interview tip โ Say the first thing that breaks is a hidden dependency on the failed region, such as a single-region DNS or IAM endpoint.