Why This Matters#

Networks carry all data between systems. If an attacker controls the network, they can intercept, modify, or block any communication. Network security creates boundaries, monitors traffic, and ensures only authorized communication occurs.


Defense in Depth#

No single control is sufficient. Layer defenses so that if one fails, others still protect:

flowchart TD
    Internet["Internet (untrusted)"]
    Internet --> Edge["Edge Security<br/>DDoS protection, CDN, WAF"]
    Edge --> Perimeter["Perimeter Firewall<br/>Stateful inspection, IPS"]
    Perimeter --> DMZ["DMZ<br/>Reverse proxies, public-facing services"]
    DMZ --> Internal["Internal Firewall<br/>Micro-segmentation"]
    Internal --> App["Application Layer<br/>Input validation, auth"]
    App --> Data["Data Layer<br/>Encryption at rest, access controls"]

Firewalls#

Types#

TypeOSI LayerInspectsStrengthsLimitations
Packet FilterL3–L4IP, port, protocolFast, simpleNo state, no content inspection
StatefulL3–L4Connection state + packetsTracks sessionsCan’t inspect encrypted traffic
Application/WAFL7HTTP content, headers, bodyDeep inspectionSlower, complex rules
Next-Gen (NGFW)L3–L7All + threat intel + user identityComprehensiveExpensive, complex

Firewall Rule Design#

Rules are evaluated top-to-bottom, first match wins:

#SourceDestinationPortProtocolAction
1AnyWeb Server443TCPAllow
2Admin VLANAny22TCPAllow
3App TierDB Tier5432TCPAllow
4AnyAnyAnyAnyDeny (implicit)

Principles:

  • Default deny — block everything, allow only what’s needed
  • Most specific rules first
  • Log denied traffic for visibility
  • Review rules regularly (remove stale entries)

Network Segmentation#

Divide the network into isolated zones to limit blast radius:

flowchart TD
    Internet["Internet"] --> LB["Load Balancer<br/>(DMZ)"]
    LB --> Web["Web Tier<br/>(VLAN 10)"]
    Web --> App["App Tier<br/>(VLAN 20)"]
    App --> DB["Database Tier<br/>(VLAN 30)"]
    
    Admin["Admin Network<br/>(VLAN 100)"] --> Web
    Admin --> App
    Admin --> DB
    
    style DB fill:#51cf66
    style Internet fill:#ff6b6b

Segmentation Methods#

MethodMechanismGranularity
VLANsLayer 2 broadcast domainsSubnet-level
Subnets + ACLsLayer 3 routing + access listsSubnet-level
Security GroupsCloud-native (AWS, Azure)Instance-level
Micro-segmentationSoftware-defined (per workload)Process-level
Service MeshSidecar proxies (Istio, Linkerd)Service-level

Zero Trust Architecture#

Traditional model: “trust inside the perimeter, verify outside.” Zero Trust: “never trust, always verify” — regardless of network location.

Principles#

PrincipleImplementation
Verify explicitlyAuthenticate and authorize every request
Least privilege accessJust-in-time, just-enough, risk-based
Assume breachMinimize blast radius, encrypt everything, verify end-to-end

Zero Trust Components#

flowchart LR
    User["User + Device"] --> PEP["Policy Enforcement<br/>Point (proxy)"]
    PEP --> PDP["Policy Decision<br/>Point (engine)"]
    PDP --> Signals["Context Signals"]
    
    Signals --> Identity["Identity<br/>(who)"]
    Signals --> Device["Device Health<br/>(what)"]
    Signals --> Location["Location<br/>(where)"]
    Signals --> Behavior["Behavior<br/>(how)"]
    
    PEP -->|"Allow/Deny"| Resource["Protected<br/>Resource"]

Zero Trust vs Traditional#

AspectTraditional (Perimeter)Zero Trust
Trust modelInside = trustedNothing trusted by default
AuthenticationAt perimeter onlyEvery request
Network accessBroad (flat network)Micro-segmented
EncryptionEdge only (TLS termination)End-to-end (mTLS)
Lateral movementEasy once insideBlocked by default

Intrusion Detection and Prevention#

IDS vs IPS#

SystemModeActionPlacement
IDSPassive (mirror/tap)Alert onlyOut-of-band
IPSInlineBlock + alertIn traffic path

Detection Methods#

MethodHow It WorksProsCons
Signature-basedMatch known attack patternsLow false positivesMisses novel attacks
Anomaly-basedDetect deviations from baselineCatches unknown attacksHigh false positives
Behavior-basedDetect suspicious sequencesContext-awareComplex to tune
HeuristicRule-based scoringFlexibleRequires expertise

Network Detection and Response (NDR)#

Modern evolution of IDS — uses ML to detect threats in network traffic:

  • Encrypted traffic analysis (metadata, not content)
  • Lateral movement detection
  • Data exfiltration patterns
  • Beaconing (C2 communication patterns)

VPN and Secure Remote Access#

VPN Types#

TypeUse CaseProtocol
Site-to-SiteConnect two networksIPsec, WireGuard
Remote AccessIndividual user to networkOpenVPN, WireGuard, IPsec
SSL VPNBrowser-based accessTLS (clientless)

VPN vs Zero Trust Network Access (ZTNA)#

AspectVPNZTNA
Access scopeFull network accessSpecific applications only
AuthenticationOnce at connectionPer-application, continuous
Lateral movementPossiblePrevented
User experienceTunnel all trafficSeamless per-app access
ScalabilityVPN concentrator bottleneckCloud-native, distributed

DNS Security#

DNS is often overlooked but critical — it’s used in many attacks:

AttackDescriptionMitigation
DNS Spoofing/PoisoningReturn false DNS responsesDNSSEC
DNS TunnelingExfiltrate data via DNS queriesMonitor DNS query patterns
Domain HijackingTake over domain registrationRegistrar lock, MFA
TyposquattingRegister similar domainsMonitor for lookalikes
DDoS via DNS AmplificationAbuse open resolversRate limiting, response rate limiting

DNSSEC#

Adds cryptographic signatures to DNS responses — clients can verify responses are authentic:

Root (.) → signs → .com → signs → example.com → signs → A record

DDoS Protection#

Attack Types#

LayerAttackMechanismVolume
L3/L4SYN FloodExhaust connection tableHigh (Gbps)
L3/L4UDP FloodOverwhelm bandwidthVery High
L3/L4Amplification (DNS, NTP)Small request → large responseVery High
L7HTTP FloodLegitimate-looking requestsLower volume, harder to filter
L7SlowlorisKeep connections open slowlyLow volume

Mitigation Layers#

LayerSolutionProvider Examples
Edge/CDNAbsorb volumetric attacksCloudflare, AWS Shield, Akamai
NetworkRate limiting, blackholingISP, transit provider
ApplicationWAF rules, CAPTCHA, rate limitingApplication-level
ArchitectureAuto-scaling, geographic distributionCloud-native

Network Monitoring#

What to Monitor#

Data SourceProvidesTools
Flow data (NetFlow/IPFIX)Who talks to whom, how muchntopng, Elastic
Packet capture (PCAP)Full content of communicationsWireshark, tcpdump, Zeek
DNS logsDomain lookupsPassive DNS, Pi-hole
Firewall logsAllowed/denied connectionsSIEM integration
Proxy logsWeb traffic detailsSquid, Zscaler

Indicators of Network Compromise#

IndicatorMay Suggest
Unusual outbound traffic volumeData exfiltration
Connections to known-bad IPs/domainsC2 communication
DNS queries to random subdomainsDNS tunneling
Internal scanning (port sweeps)Lateral movement
Traffic at unusual hoursAutomated malware activity
Encrypted traffic to unusual portsCovert channels

Key Takeaways#

  1. Defense in depth — layer firewalls, segmentation, IDS/IPS, monitoring
  2. Default deny — block everything, allow only what’s explicitly needed
  3. Zero Trust is the future — network location should not grant trust
  4. Segment aggressively — limit blast radius of any compromise
  5. Monitor everything — you can’t detect what you can’t see
  6. DNS is a blind spot — monitor DNS traffic, implement DNSSEC
  7. VPNs are being replaced by ZTNA for better security and UX