Network Security and Defense Questions
Securing networks at the infrastructure layer. Covers firewalls, ACLs and rule design, network device hardening and secure configuration, intrusion detection and prevention systems, VPN and remote-access encryption, network protocols and their security properties, and packet-level traffic analysis. The hands-on network-defense layer, distinct from zero-trust architecture strategy.
Design an anycast-based scrubbing architecture to protect a global web application with a sustained 100 Gbps baseline and potential spikes. Describe points of presence (POPs), traffic steering (BGP), health checks, how scrubbing capacity scales, and how failover behaves when a POP becomes overwhelmed. Address stateful services and latency trade-offs.
Sample Answer
Direct answer
Anycast scrubbing advertises the same IP prefix from multiple geographically distributed points of presence (POPs) via the Border Gateway Protocol (BGP), so ordinary internet routing automatically steers each client to its topologically nearest POP. That same property is the defense mechanism: an attack's traffic naturally splits across every POP announcing the prefix instead of concentrating on one path, and any POP that becomes overwhelmed can withdraw its announcement so BGP reconverges traffic to the remaining POPs.
Structured elaboration
flowchart TB
C[Clients worldwide] --> POPA[POP A scrubbing]
C --> POPB[POP B scrubbing]
C --> POPC[POP C scrubbing]
POPA --> ORIGIN[Origin application]
POPB --> ORIGIN
POPC --> ORIGIN
POPB -. overloaded withdraws route .-> C
- Points of presence and traffic steering. Deploy scrubbing POPs at multiple internet exchange points, each announcing the same anycast prefix. BGP routes each client to the lowest-cost path under normal conditions, minimizing latency for clean traffic, and under attack spreads the attacker's traffic across every announcing POP, since an attacker generally can't choose which POP their own packets land on either.
- Health checks and failover. Each POP monitors its own scrubbing throughput utilization, upstream link saturation and control-plane responsiveness. When utilization crosses a threshold, the POP withdraws (or de-prefers) its BGP announcement, and convergence redistributes its traffic to neighboring POPs, at the cost of a brief black hole for sessions mid-flight and a step increase in round-trip time for clients remapped to the next-nearest POP. If the design targets a specific availability goal, say 99.99% uptime (about 52 minutes of allowed downtime a year), that number becomes a direct constraint on how fast convergence and headroom need to be, not just a marketing figure: a black hole longer than a few seconds during failover eats into that budget quickly.
- Capacity scaling. Size each POP for more than its expected steady-state share of the 100 Gbps baseline, plus enough headroom that when a neighboring POP fails over, the remaining POPs absorb the redistributed load without cascading, that is, N+1 redundancy at the POP level, not just within one POP.
- Integrating the rest of the perimeter. Anycast scrubbing is one layer, not the whole defense. A layered posture keeps a stateful perimeter firewall behind the scrubbing layer for policy enforcement that needs connection state, coordinates with the upstream internet service provider (ISP) for scrubbing that needs to happen before traffic even reaches your POPs (relevant for the largest volumetric floods, where dropping traffic close to its source matters most), and integrates with cloud-edge services such as a CDN or reverse proxy that absorb application-layer load and cache static content so the scrubbing layer only handles what actually needs to reach the origin.
- Fine-grained mitigation once an attack is identified. Two BGP-based tools sit below POP-level failover, at different granularity. Remotely-triggered black hole (RTBH) routing advertises a narrow prefix for the specific victim address with a community that tells upstream routers to drop all traffic to it; it's coarse, since it takes the destination offline entirely (a controlled denial of service instead of an uncontrolled one), but fast and simple to roll out on any router with standard BGP support. BGP FlowSpec (originally RFC 5575, since obsoleted by RFC 8955) instead distributes a match-and-action rule, for example "drop UDP traffic to this destination on source port 123" to suppress a specific reflection technique, so only the attack's actual signature is dropped while the rest of that destination's traffic keeps flowing. FlowSpec is more surgical but requires FlowSpec support on the routers in the path, which isn't universal, and upstream providers vary in whether they'll accept a customer's FlowSpec rules; it's also slower to design correctly under time pressure than "just black-hole it."
- Stateful services and latency. Anycast works cleanly for stateless or short-lived request and response traffic, but a long-lived connection, a WebSocket or a persistent API session, can break if BGP reconverges mid-session and the client's packets start arriving at a POP with no record of that connection's state. A design serving stateful traffic either needs session affinity engineered on top of anycast (routing back to the POP holding the session, or replicating session state across POPs) or has to accept that a POP failover drops those specific sessions and the client must reconnect gracefully.
Worked example
Across 5 POPs, a 100 Gbps baseline splits evenly to 20 Gbps per POP. Sizing for N+1 within the group, so that any one POP's traffic can be absorbed by the remaining four, means the 20 Gbps carried by a POP that goes fully dark is what gets redistributed, split evenly across the 4 remaining POPs:
420 Gbps=5 Gbps extra per remaining POP
so each remaining POP then carries its own 20 Gbps share plus 5 Gbps of failover load, or 25 Gbps total (equivalently, the 100 Gbps baseline spread over the 4 remaining POPs is 100 / 4 = 25 Gbps each, which is the total per remaining POP, not the increment). Each POP should therefore be provisioned for roughly 25 Gbps, not just its steady-state 20 Gbps. That 5 Gbps of otherwise-idle headroom per POP is the concrete cost of the redundancy the availability target demands.
Trade-offs and pitfalls
BGP reconvergence is not instantaneous, ranging from sub-second to tens of seconds depending on the path, so a design that assumes zero-impact failover is wrong. RTBH's simplicity comes at the cost of completing the attacker's goal for them, the target genuinely goes offline, just on your terms, so it should trigger escalation to a more surgical mitigation like FlowSpec rather than being left in place. Provisioning every POP for full N+1 headroom against the simultaneous loss of every other POP gets expensive fast as POP count grows; real deployments typically target resilience against losing one POP, not several at once.
Compare SNMP v1/v2c with SNMPv3 from a security standpoint. Explain the risks associated with community strings, how SNMPv3 addresses confidentiality and authentication, and the operational considerations and migration steps for moving a large device fleet from v2c to v3.
Sample Answer
Direct answer
SNMPv1 and SNMPv2c authenticate with a "community string," effectively a shared clear-text password sent in every packet with no encryption. SNMPv3 replaces that with per-user authentication (a keyed hash proving both origin and integrity) and optional encryption of the payload, plus fine-grained authorization over which parts of the device's data a given user can even see.
Structured elaboration
- The community-string risk: the string travels unencrypted inside the SNMP packet, so anyone who can sniff the network segment can read it. Devices are frequently left on default strings ("public" for read, "private" for read-write), there is no per-user accountability since everyone with the string looks identical to the device, and if the string grants write access, an attacker who captures it can read and modify device configuration, not just monitor it.
- How SNMPv3 addresses this, via the User-based Security Model (USM):
- Authentication: a per-user keyed hash (SHA is preferred over the legacy MD5 option) proves each message's origin and that it was not altered in transit.
- Privacy (confidentiality): an optional encryption layer (AES is preferred over the legacy DES option) hides the payload from anyone sniffing the wire.
- These combine into three selectable security levels: noAuthNoPriv, authNoPriv, and authPriv (the recommended level for anything beyond a fully trusted lab network).
- Authorization: View-based Access Control (VACM) restricts which specific management-information-base (MIB) objects a given user or group can read or write, instead of v1/v2c's all-or-nothing, community-wide access.
- Migration steps for a large device fleet, v2c to v3:
- Inventory every current community string and every tool (monitoring system, trap receiver, ad hoc script) that polls each device, and confirm every one of those consumers actually supports SNMPv3, which is often the real blocker, not the devices themselves.
- Design the USM user/group model (which auth and privacy algorithms, which users map to which teams or functions, which VACM views each needs) before touching a single device.
- Run a dual-stack pilot: configure SNMPv3 users alongside the existing v2c community on a small representative group of devices, and confirm polling, alerting, and trap delivery all still work end to end.
- Roll out fleet-wide through configuration automation, verifying each device is successfully answering v3 queries before disabling v2c on that specific device, not on the fleet as a whole at once.
- Disable v2c (remove the community strings entirely) only once every consumer is confirmed migrated, then rotate or retire the old strings so they cannot be reused if they leak later.
- On an ongoing basis, rotate SNMPv3 credentials periodically and audit for any device that is still silently answering v2c queries, which is a sign of configuration drift creeping back in.
Worked example
An SNMPv1/v2c GET request carries the community string as a plain ASN.1 octet string inside a UDP/161 packet, with no encryption layer at all. An attacker on the same network segment sniffing that packet reads the string directly (say, "public"), then reuses it to walk the device's entire MIB tree. If that same string also happens to be configured for write access (a common misconfiguration when "private" is left at its default), the attacker can issue an SNMP SET to change something like an interface's administrative status or a routing parameter, using nothing more than a passively captured plaintext value.
Trade-offs and pitfalls
- Disabling v2c before every legacy monitoring consumer has actually migrated does not just create a security gap, it creates a monitoring blind spot, which is often worse in the moment than the risk the migration is trying to fix.
- SNMPv3's authPriv mode adds per-packet cryptographic overhead; usually negligible on modern hardware, but worth checking on old or embedded devices with limited CPU headroom.
- Community strings cannot be rotated invisibly across a fleet; anything still depending on the old value will break the instant it changes, which is exactly why the staged, dual-run migration above is not optional shortcut-taking, it is the actual safe path.
Describe how ARP spoofing (ARP poisoning) can be used for local man-in-the-middle attacks. Provide at least three detection or mitigation techniques you would deploy in a switched LAN, describe the limitations of each, and explain how an analyst would verify an attack is occurring.
Sample Answer
The Address Resolution Protocol (ARP) has no built-in authentication, so ARP spoofing, also called ARP poisoning, works by an attacker sending forged ARP replies that map a legitimate address, commonly the default gateway, to the attacker's own MAC address. Victim hosts then send their traffic to the attacker instead, giving the attacker a local man-in-the-middle position.
Detection and mitigation techniques
- Dynamic ARP Inspection (DAI) on managed switches: validates every ARP packet against a trusted IP-to-MAC binding table, usually built from DHCP (Dynamic Host Configuration Protocol) snooping, and drops and logs any reply that does not match. Limitation: requires switches that support DAI and DHCP snooping enabled correctly on every access port, offers no help for a host that is statically addressed unless a manual binding is added, and does nothing for an attacker positioned upstream of the enforcement point.
- Static ARP entries for critical hosts, for example hardcoding the gateway's IP-to-MAC mapping on servers that must never be intercepted. Limitation: this does not scale, since every mapping is manual and per-host, and it only protects the specific entries pinned, not general LAN traffic.
- Passive ARP monitoring, watching for a MAC address suddenly claiming an IP it has never used, or one IP mapping to multiple MACs, and alerting on the change. Limitation: this is detection after the fact, not prevention, so an attacker still gets a window before anyone responds.
Verifying an attack is occurring
Pull the ARP table from several hosts, and from the switch's own binding table, and compare the MAC address recorded for the gateway's IP across all of them. An inconsistency, most hosts showing the real gateway MAC while one shows a different MAC, points at a targeted poisoning rather than a network-wide problem. A packet capture on the suspect segment showing repeated, unsolicited (gratuitous) ARP replies for the gateway's IP address, especially from a MAC not in the asset inventory, confirms it directly.
Worked example
Gateway is 10.0.0.1, real MAC 00:11:22:33:44:55. An attacker broadcasts a gratuitous ARP reply claiming "10.0.0.1 is at AA:AA:AA:AA:AA:AA." The victim's ARP cache updates to the attacker's MAC for 10.0.0.1. An analyst runs the ARP table command on the victim and on a known-clean host in the same segment side by side: the clean host shows 10.0.0.1 mapped to the real MAC, the victim shows it mapped to the attacker's MAC, confirming the poisoning on that specific host.
Trade-offs and pitfalls
Dynamic ARP Inspection is the strongest single control here, but it is an investment in switch capability and configuration discipline across every access port, one unmanaged or misconfigured port re-opens the whole LAN to the same attack. Static entries and passive monitoring are cheap stopgaps for a handful of critical hosts, not a solution for the whole network.
Design a layered DDoS mitigation strategy for a public-facing platform with strict availability requirements. Describe network, transport, and application-layer defenses, how you would integrate a CDN and edge/scrubbing providers, rate-limiting strategy, autoscaling considerations, and how to avoid undue cost or disruption to legitimate users during an attack.
Sample Answer
A layered DDoS mitigation design puts the cheapest, fastest filtering closest to the edge, so only traffic that survives multiple independent checks ever reaches expensive application compute, and it treats cost and legitimate-user experience as first-class design constraints, not afterthoughts.
Traffic flow
flowchart LR
U[Users] --> DNS[Anycast DNS / GSLB]
DNS --> CDN[CDN Edge PoPs]
CDN --> SCRUB[DDoS Scrubbing Layer]
SCRUB --> WAF[WAF plus L4 Firewall]
WAF --> LB[Load Balancer]
LB --> ASG[Autoscaling App Tier]
ASG --> DB[(Database)]
Layer by layer
- Network layer: anycast routing across many points of presence (PoPs) spreads a volumetric flood across many entry points instead of concentrating it on one origin link, and an upstream scrubbing service inspects and drops attack traffic before it reaches your own infrastructure.
- Transport layer: SYN cookies and connection-rate limiting at the edge, dropping malformed or protocol-violating packets, and capping concurrent connections per source.
- Application layer: a web application firewall (WAF) for known attack signatures, plus behavioral rate limiting keyed on request shape (path, session presence, user agent), not raw volume alone, since volume-only limiting cannot tell a real flash sale from an application-layer flood.
- CDN (content delivery network) integration: cache every cacheable response at the edge so a large flood of requests for static content never reaches the origin at all. For dynamic, non-cacheable traffic like checkout, externalize session state to a shared store rather than pinning a user to one application server, so a session survives being served by a different node during a failover or edge reroute under attack, this is the session-integrity concern that matters most during exactly the kind of traffic surge a sale or an attack both produce.
- Rate-limiting strategy: coarse, cheap per-address or per-network token-bucket limits at the edge, backed by finer, more expensive per-account or per-session limits closer to the application, so most abusive traffic is stopped before it reaches the costlier logic.
- Autoscaling: scale the application tier for legitimate surges, but only on validated traffic that has already passed scrubbing and the WAF, with a hard ceiling on maximum scale-out and budget alerting. Autoscaling on raw, unfiltered request volume turns an availability attack straight into a cost attack, since you end up paying to serve the flood instead of blocking it.
- Avoiding disruption to legitimate users: challenge suspicious clients instead of outright blocking them when confidence is not high, keep an explicit allowlist for known-good dependencies like payment processors and health checks, and rehearse the failover path in advance so a real sales-driven spike does not accidentally trip the same controls built for an attack.
Worked example
The origin fleet is provisioned for a sustainable 5,000 requests per second. A legitimate high-traffic event might reach 4x baseline, 20,000 requests per second, which autoscaling should absorb by design. An application-layer DDoS instead drives 200,000 requests per second, 40x baseline, concentrated on the login endpoint from 50,000 distinct addresses (about 4 requests per second per address, too smooth to trip a naive per-address limiter). Letting autoscaling alone respond to that 40x jump would mean paying for 40x capacity; instead, the scrubbing and WAF layer drops requests missing a valid session cookie or matching a known bot fingerprint, cutting the volume back down before it ever reaches the autoscaled tier.
Trade-offs and pitfalls
Treating autoscaling as your DDoS mitigation turns availability risk into cost risk instead of removing it. Overly aggressive edge blocking creates false positives against real users behind shared or corporate proxy addresses. Every added layer (scrubbing, CDN, WAF) adds a small amount of latency to every legitimate request, which is the price of the resilience. And if the mitigation path is only tested during a real attack, the first real test of session externalization and failover happens under the worst possible conditions, which is why it belongs in a scheduled game-day exercise instead.
Compare and contrast Security Groups (AWS), Azure NSGs, and a vendor-managed Next-Gen Firewall (NGFW) when used for east-west segmentation inside a cloud VPC/VNet. Discuss capabilities, stateful behavior, performance, and scenarios where NGFW is worth the extra cost.
Sample Answer
Direct answer
For east-west segmentation (controlling the traffic that moves server-to-server inside the network, as opposed to north-south traffic entering and leaving it) inside one cloud virtual network, cloud-native constructs, AWS Security Groups or Azure Network Security Groups (NSGs), give stateful, software-defined segmentation attached directly to compute resources at no added latency or licensing cost. A vendor-managed next-generation firewall (NGFW) inserted into the traffic path adds real per-flow inspection depth, application awareness, intrusion prevention signatures, and unified logging, at the cost of extra network hops, licensing spend, and an appliance you now have to size, patch, and keep highly available.
Structured elaboration
AWS Security Groups. Stateful, attached at the instance or Elastic Network Interface (ENI) level, and allow-only: they have no explicit deny rule, so anything not explicitly allowed is implicitly denied. Because they are stateful, a permitted inbound connection's return traffic is automatically allowed back out without a matching outbound rule.
Azure NSGs. Also stateful, but unlike Security Groups they support both explicit Allow and explicit Deny rules evaluated in priority order, and they can be attached at either the subnet level or the network interface level, a real behavioral difference from AWS's model where the interface is the only attachment point.
Vendor NGFW inside the Virtual Private Cloud (VPC) or virtual network (VNet). Typically deployed as an appliance instance, or a managed gateway-style service, sitting in the traffic path, often using route-table tricks or a gateway load-balancer pattern to force east-west traffic through it. It provides deep packet inspection, application-level control, unified logging and alerting across an entire fleet from one console, and often intrusion prevention signatures, none of which Security Groups or NSGs offer, since those only ever match on address, port, and protocol.
Performance. Security Groups and NSGs are enforced inside the cloud provider's own software-defined network fabric, adding essentially no extra network hop. An NGFW appliance is a real extra hop in the path, even a "transparent" one, adding processing overhead and becoming both a throughput ceiling and a single point of failure unless it is deployed as a highly-available pair or cluster.
When the NGFW is worth the added cost. A compliance requirement calling for a specific class of deep inspection that address-and-port matching genuinely cannot express; especially sensitive east-west traffic, such as payment processing or data heavy in personally identifiable information, where centralized intrusion-prevention logging across many virtual networks is worth paying for; or a hybrid environment that has already standardized on one vendor's NGFW on-premises and wants one policy model and one console across both environments.
When Security Groups or NSGs alone are the right call. The large majority of ordinary east-west segmentation, for example "the web tier cannot reach the database tier except on its database port," is fully expressible as address, port, and protocol, and the organization is usually better off avoiding the cost, latency, and operational burden of an appliance for a control the native tooling already provides for free.
Worked example
A three-tier application inside one VPC: the web tier's Security Group allows inbound port 443 only from the load balancer's Security Group; the application tier's Security Group allows inbound only from the web tier's Security Group on its application port; the database tier's Security Group allows inbound only from the application tier's Security Group on its database port, and nothing else. That layers three independent, zero-cost, stateful controls. If the organization later needs to detect and block SQL-injection-style payloads specifically targeting the internal application-to-database calls, a control the database Security Group's port-based rule simply cannot express, that is the point where inserting an NGFW between the application and database tiers becomes worth its added cost and latency, because the requirement has genuinely become about payload content, not reachability.
Trade-offs and pitfalls
Over-provisioning an NGFW for every east-west hop when Security Groups or NSGs would already suffice is a common source of unnecessary latency and cost. Conversely, relying purely on Security Groups or NSGs when the real threat model requires payload inspection, not just reachability control, under-protects a genuinely sensitive path. A pitfall specific to Security Groups is forgetting they only support allow rules, so a "deny except this one thing" mental model does not map directly; you have to think purely in terms of what you explicitly permit, which trips up engineers coming from an NSG or on-premises access control list background where explicit deny rules exist.
Unlock Full Question Bank
Get access to all 49 Network Security and Defense interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.