Network protocols for defenders: what each layer tells you in a capture

Ethernet, IP, TCP, UDP, DNS, TLS, and HTTP as they appear in a packet capture: the fields worth reading at each layer, a worked tcpdump trace of one web request, and which protocols leak what.

Lesson 1 of 17 · 14 min read · practice only with authorization

Diagram

One HTTPS request, layer by layer

Follow the path. One example at a time.

Step 1 of 4

Name lookup

DNS resolves the host, usually over UDP 53.

Illustration: Name lookup
10:02:11.101 IP 10.0.0.23.51514 > 10.0.0.2.53: 4417+ A? shop.example.test. (35)
10:02:11.104 IP 10.0.0.2.53 > 10.0.0.23.51514: 4417 1/0/0 A 198.51.100.40 (51)
What changes the outcome
DNS

Names visible

HTTP

Everything visible

FTP/Telnet

Passwords visible

The example on the open step is one illustration, or the fix you can paste into an application you own.

What this page is made of

3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.

  1. Layers as questions

    What fails
    Each layer answers a different question: who on the link, which host, which service, what content.
    Who is affected
    Analysts reading captures.
    What you would notice
    Investigations that jump straight to payloads.
    What you change
    Read addresses, ports, and flags before content.
  2. Clear-text protocols

    What fails
    Telnet, FTP, HTTP, SNMPv1/v2c, and LDAP without TLS expose credentials on the wire.
    Who is affected
    Accounts used over those protocols.
    What you would notice
    Captures showing USER/PASS or community strings.
    What you change
    Replace with SSH, SFTP, HTTPS, SNMPv3, and LDAPS.
  3. Metadata survives encryption

    What fails
    Even with TLS, IPs, ports, SNI, timing, and sizes are visible.
    Who is affected
    Users whose behavior can be inferred.
    What you would notice
    Sensitive service names in SNI.
    What you change
    Consider what metadata reveals when designing services.

Ports worth recognizing

Knowing the common ports lets you read a capture or a firewall rule quickly.

  • 22 SSH, 25/587 SMTP, 53 DNS, 80/443 HTTP(S)
  • 88 Kerberos, 389/636 LDAP/LDAPS, 445 SMB
  • 123 NTP, 161 SNMP, 514 syslog
  • 3389 RDP, 5985/5986 WinRM
  • 3306 MySQL, 5432 PostgreSQL, 6379 Redis

TCP versus UDP in practice

TCP has a handshake, sequence numbers, and retransmission, so you can see connection setup and resets. UDP has none, so a request and reply are just two datagrams and spoofed sources are easier. That difference explains why UDP services such as DNS and NTP are used in reflection attacks.

Going further

The tcpdump and Wireshark lessons in the tool library teach filters and dissectors in depth, using captures you record yourself.

Check yourself

Recognition and the fix. Nothing here is a procedure.

1 / 3

A capture of an HTTPS request shows the hostname. Where did it come from?

Go deeper

Specific techniques, exercises, and glossary cards for this topic.

  1. 01Which resolver and which DHCP server you trustHosts believe the answers they are given for names and for their own address. Includes the diagram and a defensive fix.
  2. 02Keep the management plane off the guest networkSSH, hypervisors, database ports, and switch admin interfaces are not guest services. Includes the diagram and a defensive fix.
  3. 03Computer networks: addresses, subnets, routing, and DNS for security workHow a packet finds its way: IPv4 and IPv6 addresses, CIDR subnets, gateways, NAT, and DNS, with the commands that show each on your own machine. Includes the diagram and a defensive fix.
  4. 04Man-in-the-middle attacks: where interception happens and what stops itInterception can happen on the local link, in DNS, at a rogue Wi-Fi access point, or through a trusted proxy. Includes the diagram and a defensive fix.
  5. 05Denial of service and DDoS: volumetric, protocol, and application floodsThe three families of denial-of-service attack, what each exhausts (bandwidth, connection state, or application work), how botnets and reflection amplify them, and the layered defenses from upstream scrubbing to rate limits. Includes the diagram and a defensive fix.
  6. 06ARP spoofing: detecting forged neighbor replies on a LANARP has no authentication, so any host on a VLAN can claim to be the gateway. Includes the diagram and a defensive fix.
  7. 07DNS spoofing and cache poisoning: forged answers and how DNSSEC helpsForged DNS answers send users to the wrong address. Includes the diagram and a defensive fix.
  8. 08TCP/IP weaknesses: spoofing, fragmentation, and session hijacking explainedIP was designed without authentication, which allows spoofed source addresses, fragment tricks, and TCP reset or hijack attacks. Includes the diagram and a defensive fix.
  9. 09Port scanning and network mapping with Nmap: scope, options, and reading resultsHow to map hosts and services on networks you are authorized to test: discovery, TCP connect and SYN scans, version detection, and reading open, closed, and filtered states. Includes the diagram and a defensive fix.
  10. 10Network traffic analysis: from packet capture to findings with Zeek and WiresharkHow to capture and analyze traffic for an investigation: where to capture, how to keep evidence intact, how Zeek turns pcaps into connection, DNS, and TLS logs, and a worked example that finds a beaconing host. Includes the diagram and a defensive fix.
  11. 11ICMP redirects: why hosts should ignore route hints from the LANICMP redirect messages tell a host to use a different gateway, and a forged one can reroute traffic. Includes the diagram and a defensive fix.
  12. 12hping3 in a lab: crafting TCP packets to see SYN floods and firewall behaviorhping3 builds custom TCP, UDP, and ICMP packets, which makes it a teaching tool for how SYN floods fill connection tables and how firewalls answer. Includes the diagram and a defensive fix.
  13. 13Yersinia and layer 2 protocol risks: STP, DTP, CDP, and DHCP on switchesYersinia is a lab framework for testing layer 2 protocols such as STP, DTP, CDP, and DHCP. Includes the diagram and a defensive fix.
  14. 14BGP hijacking: route origin validation with RPKI and monitoringBGP routers trust announcements from peers, so a wrong origin or more-specific prefix can pull traffic away. Includes the diagram and a defensive fix.
  15. 15Egress filtering: controlling what can leave your networkMost networks filter inbound traffic carefully and let everything out. Includes the diagram and a defensive fix.
  16. 16Downgrade attacks: forcing weaker protocols and how modern TLS prevents itA downgrade pushes two parties onto an older, weaker protocol or cipher than both support. Includes the diagram and a defensive fix.
  17. 17Zero trust, practically: identity, device, and per-request decisionsZero trust replaces “inside the network means trusted” with a decision on every request based on user, device, and context. Includes the diagram and a defensive fix.

Exercises

  1. 01Terminal mission: Database ports published to the worldA Compose file publishes ports for five services. Work out which ones listen on every interface, which are bound to localhost only, and why the host firewall does not save you.
  2. 02Terminal mission: TLS 1.0 hiding in an includeThe main TLS settings look fine, but one server block includes an old snippet. Follow nginx includes to find the site that still allows TLS 1.0 and a 3DES cipher.

Glossary

  1. 01Denial of serviceTraffic, expensive requests, or a fragile protocol state exhausts a service so legitimate users cannot use it.
  2. 02ARP spoofingOn a local network, a host claims to be the gateway and sees traffic that was not meant for it.
  3. 03DNS spoofingA resolver is fed a lie, and a name points at the wrong address.
  4. 04BGP hijackingA network announces address space it does not own, and some of the internet believes it.