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 a defense plan to prevent MITM attacks on corporate Wi-Fi used by employees and contractors. Include authentication method choice, certificate management, guest vs internal segmentation, detection telemetry to collect, and operational steps to detect rogue APs or ARP spoofing.
Sample Answer
Direct answer
Eliminate the two easiest man-in-the-middle (MITM) vectors on corporate Wi-Fi: weak shared authentication and a flat network. Move to certificate-based 802.1X (port-based network access control) so devices mutually authenticate instead of trusting anything broadcasting the right network name, fully separate guest traffic onto its own segment with no path to internal resources, and layer on wireless intrusion detection plus wired-side Address Resolution Protocol (ARP) monitoring to catch whatever gets through anyway.
Structured elaboration
- Authentication method. Use WPA2/WPA3-Enterprise with 802.1X and EAP-TLS (client and server certificates), not a pre-shared key (PSK). A shared passphrase means any device that has it, including one belonging to someone who left the company, can decrypt other clients' traffic or stand up a fake access point (AP) with the same name and password. With EAP-TLS, the client also validates the authentication server's certificate before associating, so a rogue AP without a certificate signed by the corporate authority fails the handshake instead of silently accepting the client.
- Certificate management. Run an internal or managed public key infrastructure (PKI) issuing device or user certificates, with short-enough validity windows and automated renewal through mobile device management (MDM) profiles so nobody hand-installs certificates. Maintain a revocation path (a certificate revocation list or OCSP, the Online Certificate Status Protocol) so a lost device or terminated employee stops authenticating immediately, not at next renewal.
- Guest versus internal segmentation. Give guests and contractors their own network name mapped to its own VLAN, routed only to the internet with no Layer 2 or Layer 3 path to internal subnets, its own DHCP scope, and rate limiting. Treat any device without proper 802.1X credentials as a guest, including contractor laptops, since those are exactly the devices most likely to be compromised or misconfigured.
- Detection telemetry to collect. Wireless intrusion detection system (WIDS) alerts for unauthorized access points broadcasting your network name (the classic rogue-AP or evil-twin signature); signal-strength and location anomalies (the same network name suddenly appearing far stronger from an unexpected direction); spikes in 802.1X authentication failures; and, on the wired side, gratuitous ARP replies that reassign a known IP address to a new hardware address.
- Operational detection steps. Run periodic radio-frequency scans comparing observed access-point identifiers against an authorized inventory; flag anything broadcasting a corporate network name that isn't on that list as a suspected rogue AP and physically locate it via signal triangulation. On switches, enable dynamic ARP inspection, which validates ARP replies against DHCP-snooping bindings, so a spoofed reply claiming to be the default gateway is dropped at the switch port before every host on the segment accepts it.
Worked example
The office has 40 authorized access points inventoried by their identifiers, forming the WIDS baseline. One afternoon it reports a 41st identifier broadcasting the corporate network name at a signal strength suggesting it's inside the building rather than at any known AP location. Because clients use EAP-TLS, they can't associate to it (it has no certificate signed by the corporate authentication server), so the immediate risk is limited to a failed-association nuisance rather than credential theft. It's still treated as a physical-security incident: the device is located via triangulation from two more scan points, and the nearest switches' ARP tables are cross-checked to confirm no device suddenly claimed the gateway's address.
Trade-offs and pitfalls
EAP-TLS is far stronger than a shared passphrase, but it comes with a real operational cost: certificate issuance, renewal and revocation need to be automated or they become an ongoing help-desk burden. Guest isolation only works if it's enforced at the network layer, not just by using a different network name; a guest VLAN that still routes to internal subnets through a misconfigured firewall rule defeats the whole design. Dynamic ARP inspection depends on accurate DHCP-snooping bindings, so devices with static IPs need explicit exceptions or they get blocked. Detection (WIDS, ARP inspection) is a backstop, not a substitute for prevention; a rogue AP that never gets a client to associate is a far smaller incident than one that does.
Explain what 'defense in depth' means in network security for a company's infrastructure. Name at least four distinct layers you would use and give a concrete example control or device you would deploy at each layer for both an on-premises datacenter and a public cloud environment. Discuss briefly why multiple layers reduce risk compared to relying on a single control.
Sample Answer
Defense in depth means layering multiple, independent security controls so that if one layer fails or is bypassed, the attacker still has to get through others before reaching the target. No single control, including a firewall, is ever treated as sufficient on its own.
Layers, on-premises and in the cloud
| Layer | On-premises datacenter | Public cloud |
|---|---|---|
| Network/perimeter | Firewall plus an intrusion prevention system (IPS) at the datacenter edge, with public-facing servers isolated in a demilitarized zone (DMZ) | Cloud security groups (stateful, per-instance) and cloud network access control lists (stateless, per-subnet), plus a managed distributed denial of service (DDoS) scrubbing service in front of the environment |
| Host | Hardened OS baseline, host-based firewall, endpoint detection and response (EDR) agent | Same hardened golden image baseline, EDR agent, metadata-service access locked down |
| Application | A web application firewall (WAF) in front of internal apps, input validation, request rate limiting | Managed WAF on the load balancer or content delivery network (CDN), same input validation in code |
| Data | Disk and database encryption at rest, data loss prevention (DLP) scanning | Server-side encryption on storage with managed keys, DLP on outbound transfers |
| Monitoring | Centralized logging into a SIEM (security information and event management system), correlated with the on-prem intrusion detection system (IDS) | Cloud-native flow logs and a managed threat-detection service feeding the same SIEM |
The cloud row of the network layer is itself a small defense-in-depth stack: CDN edge caching, a managed WAF, and a DDoS-scrubbing layer each catch a different class of unwanted traffic before it reaches the origin, which is the same layering principle applied at just the perimeter.
Why a firewall alone is not enough
A perimeter firewall only sees and filters traffic crossing the network boundary. It does nothing once an attacker already has a foothold inside (lateral movement between internal hosts never crosses the firewall), it cannot distinguish a malicious request from a legitimate one riding on an already-allowed port like 443, and it offers zero protection against stolen credentials or an insider, since that traffic looks completely normal at the network layer.
Worked example
An employee is phished and their laptop is compromised. Network segmentation (layer 1) confines that laptop's virtual LAN (VLAN), a logically separate broadcast domain on shared switches, so it cannot reach the database subnet directly. If it somehow could, the host EDR agent (layer 2) should flag the malicious process and isolate the host. If that is also missed, least-privilege application accounts (layer 3) mean the compromised laptop's user session does not itself hold direct database credentials. If an attacker still manages to exfiltrate data, DLP scanning (layer 4) should trip an alert on the bulk transfer. Four independent layers give four independent chances to catch or contain the same incident, versus a single perimeter firewall, which offers no further resistance at all once phishing (which never crosses the network boundary) has already succeeded.
Trade-offs and pitfalls
More layers mean more cost and operational complexity, and uncorrelated alerts from every layer can cause alert fatigue unless a SIEM ties them together into one incident view. Layering can also create a false sense of security if the layers are never tested together, since independently-built layers can still share one common blind spot, such as all of them trusting the same misconfigured identity provider.
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.
Describe SNAT, DNAT, and PAT (port address translation). Explain how NAT complicates network visibility for logging, IDS/IPS correlation, and incident response. Provide at least two techniques to improve visibility and traceability when NAT is in use.
Sample Answer
Direct answer
SNAT is a form of Network Address Translation (NAT) that rewrites a packet's source address, typically so private internal hosts can share one or a few public IPs when going outbound. DNAT rewrites a packet's destination address, typically to publish an internal server behind a single public-facing IP for inbound traffic. PAT (port address translation, also called NAT overload) is the common form of SNAT where many internal hosts share a single public IP by also remapping source ports, using the IP-plus-port pair as the key that keeps every host's flows distinguishable.
Structured elaboration
- SNAT: applied as traffic leaves a trust boundary; the internal, typically private (RFC 1918) source address is replaced with a public one so return traffic can route back on the public internet.
- DNAT: applied as traffic enters a trust boundary; a public IP and port are mapped to an internal server's real address and port, so external clients never see the internal addressing scheme.
- PAT/NAT overload: a specific SNAT variant that multiplexes many internal hosts onto one public IP by using the source port (in addition to the IP) as the distinguishing key in the translation table, allowing tens of thousands of concurrent flows to share a single address, bounded in practice by the usable port range per IP.
- Why NAT complicates visibility:
- Logging: a log captured after translation only shows the public/translated address, not which internal host actually originated the flow, unless the NAT device separately logs the pre-translation tuple at the moment of translation.
- IDS/IPS (intrusion detection/prevention system) correlation: an alert that fires on a translated address does not by itself identify which internal host is compromised (for outbound alerts) or which internal server was actually targeted (for inbound alerts); correlating requires cross-referencing the NAT session table at the exact timestamp of the alert, and most devices only retain that table briefly.
- Incident response: attribution and containment (quarantining "this host") require mapping an externally observed IP:port back to a specific internal host and time window; if translation logs were not captured and retained, that reconstruction can become impossible after the fact.
- Techniques to improve visibility and traceability:
- Enable and centrally ship NAT translation logs (pre-NAT and post-NAT IP:port pairs with timestamps) to a SIEM or log aggregator, with retention long enough to cover a realistic investigation window, not just the NAT device's default short-lived table.
- Avoid heavy PAT overloading on segments where traceability actually matters: use 1:1 static NAT or a larger public address pool so fewer internal hosts share each translated address, shrinking the ambiguity window an investigator has to untangle. Where the platform supports it, export NAT-aware flow records (NetFlow/IPFIX carrying both pre- and post-NAT tuples) as a third option.
Worked example
Consider one public IP fronting 500 internal hosts through heavy PAT, where each host holds several concurrent connections. If a security alert names "external IP X, port Y" from ten minutes ago, and the NAT device's translation table only retains recent mappings, that exact IP:port pair may already have been recycled to a completely different internal host by the time anyone looks it up, since ephemeral ports get reused quickly under load. This is precisely why logging the mapping at the moment of translation (not querying "the current NAT table") is the only reliable way to identify the true source after the fact.
Trade-offs and pitfalls
- Moving toward 1:1 NAT or a larger public pool for better traceability consumes more public address space, which is increasingly scarce and costly, especially for IPv4.
- Logging every translation event at high volume can itself become a real storage and processing cost, so scope detailed translation logging to security-relevant zones rather than capturing it blanket, fleet-wide.
- At internet scale, carrier-grade NAT (many customers sharing one public IP at an ISP) makes this same ambiguity problem far worse, which is a major reason raw IP-based blocking and attribution has become progressively less reliable on the public internet.
Explain the difference between an Intrusion Detection System (IDS) and an Intrusion Prevention System (IPS). In your answer describe deployment modes (inline vs passive), typical system responses to detections (alert/log vs block), performance and reliability implications (latency, fail-open/fail-closed), and give two concrete scenarios where you would prefer IDS over IPS and vice versa.
Sample Answer
An intrusion detection system (IDS) monitors traffic and raises alerts on suspicious activity without touching the traffic itself. An intrusion prevention system (IPS) sits inline and can actively block or drop traffic it judges malicious, in real time. The core difference is detection versus active enforcement.
Deployment modes
An IDS is typically deployed passively, out-of-band, receiving a copy of traffic through a network tap or a mirrored switch port, so it observes without ever being in the actual data path. An IPS is deployed inline, directly in the path of live traffic, so every packet physically passes through it before continuing on.
Response to detections
An IDS alerts and logs only; a human or a downstream system decides what to do next. An IPS can automatically block, drop, or reset the offending connection in real time, with no human in the loop for that specific decision.
Performance and reliability implications
Because an IDS is out-of-band, it adds zero latency to production traffic, and a false positive costs nothing but an unnecessary alert. Because an IPS is inline, every packet's processing adds some latency, and a false positive can actively break legitimate traffic. Being inline also forces a deliberate fail-open versus fail-closed design decision: if the IPS device itself fails or is overwhelmed, "fail open" lets traffic pass through uninspected, prioritizing availability, while "fail closed" blocks all traffic through that path, prioritizing security. This choice has to be made explicitly for each deployment rather than left to whatever the device defaults to.
Two scenarios
Prefer IDS when evaluating a brand-new detection ruleset that is not yet fully trusted. Running it in alert-only mode first lets a team see what it would have blocked and tune out false positives before ever risking dropping legitimate production traffic. Prefer IPS when protecting a public-facing service against a known, high-confidence attack signature for a critical, unpatched vulnerability, where the cost of failing to block a real attack clearly outweighs the small risk of a false-positive block, and where an automatic response matters because a human alert-and-respond loop would be too slow.
Worked example
A company rolling out a new IPS ruleset first mirrors production traffic to the device configured in alert-only mode for two weeks and reviews every alert, discovering that 30% of alerts were false positives caused by an internal vulnerability scanner's own traffic being misclassified as an attack. After tuning that source out, they cut the same ruleset over to true inline enforcement with confidence that legitimate scanner traffic will not be auto-blocked mid-scan.
Trade-offs and pitfalls
Deploying an unvetted, out-of-the-box IPS ruleset inline risks blocking legitimate traffic, a self-inflicted denial of service, and is a common real-world mistake. Deploying detection-only for a well-understood, high-confidence threat wastes the opportunity for automatic containment and relies entirely on someone reading the alert in time, which especially at 3am is not guaranteed.
Unlock Full Question Bank
Get access to all 29 Network Security and Defense interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.