TCP/IP Model Explained for Security Analysts: 4 Layers, Headers and Real Traffic

It is 3 AM in the SOC. An alert says a database server has sent around 50 GB to an external IP address with no reputation. You have a few minutes to decide whether this is a scheduled backup or a data breach.

You will not solve this by reciting seven OSI layers. You solve it by reading what each layer of the TCP/IP model tells you: which IP the traffic went to, which port and protocol it used, whether the TCP session was normal, and what the application layer says about it. That is the model your logs, packet captures and firewall rules are actually built on.

This guide explains the four TCP/IP layers from a security analyst’s point of view: which header fields matter in an investigation, how to read a real connection in a packet capture, what TCP flags reveal about scans and floods, and which detections and controls belong at each layer. For the seven-layer troubleshooting checklist, see the companion OSI model guide.

Key takeaways

  • The TCP/IP model has four layers: Application, Transport, Internet and Link. Every packet you investigate is built from these layers.
  • A handful of header fields answer most investigation questions: IP addresses, TTL, ports, TCP flags, sequence numbers and byte counts.
  • TCP flag patterns tell you a lot on their own: SYN without ACK, RST replies and silence each mean something different.

What is the TCP/IP model?

The TCP/IP model is the layered architecture the Internet actually runs on. It grew out of ARPANET research and is formally described in RFC 1122, which defines four layers for Internet hosts. The OSI model is a reference model used for teaching and troubleshooting. TCP/IP is the working implementation.

It is named after its two best-known protocols: the Transmission Control Protocol, now specified in RFC 9293, and the Internet Protocol (RFC 791). Every time a Windows laptop talks to a Linux server in the cloud, both follow the same TCP/IP rules, which is why they understand each other.

Some textbooks show a five-layer version that splits the Link layer into Data Link and Physical. The idea is the same. This guide uses the four layers from RFC 1122.

The four layers and what each one tells an analyst

Whiteboard diagram of the four TCP/IP layers with example protocols at each layer
TCP/IP layerAdds / usesKey fields for investigationsWhere you see it
ApplicationHTTP, DNS, TLS, SMTP, SSHDomain names, URLs, user agents, TLS SNI, HTTP status codesProxy, DNS and web server logs
TransportTCP or UDP headerSource and destination ports, TCP flags, sequence numbers, window sizeFirewall session logs, NetFlow, packet captures
InternetIP headerSource and destination IP, TTL, protocol number, fragmentation flagsRouter and firewall logs, NetFlow
LinkEthernet / Wi-Fi frameMAC addresses, VLAN ID, ARP mappingsSwitch logs, MAC tables, local captures

Application layer

This is where the user’s intent lives: a DNS lookup, an HTTPS request, an email. It also carries most attacks that target people and software, such as phishing over SMTP, SQL injection over HTTP and command-and-control hidden in DNS. Even when traffic is encrypted, the TLS handshake usually reveals the server name (SNI), which is often enough to spot a suspicious destination.

Transport layer

TCP provides reliable, ordered delivery using a three-way handshake, sequence numbers and acknowledgements. UDP sends datagrams with no handshake and no delivery guarantee, which suits DNS queries, voice and video. Ports identify the service: 443 for HTTPS, 22 for SSH, 53 for DNS. Traffic on unusual ports, such as 4444 (the default for some exploitation frameworks), deserves a closer look, though attackers often use 443 precisely because it blends in.

Internet layer

IP adds the source and destination IP addresses that let routers move packets between networks. The TTL (time to live) field drops by one at each router hop. Default starting values differ by operating system (commonly 128 for Windows and 64 for Linux), so an unexpected TTL can hint at a spoofed packet or an unexpected device. ICMP, used by ping and traceroute, also lives here.

Link layer

The Link layer delivers frames on the local network using MAC addresses, with ARP mapping IP addresses to MAC addresses. Attacks here only work from inside the local segment, such as ARP spoofing and MAC flooding, but they can let an attacker intercept everything on that segment.

Following one HTTPS request through the layers

Here is what happens when a workstation at 10.10.1.25 opens an internal web application at 172.16.0.5. Each step is a different layer doing its job:

  1. Application: the browser asks DNS for the server’s IP address (UDP 53), then prepares an HTTPS request.
  2. Transport: TCP picks a random source port (55210) and starts a handshake to port 443.
  3. Internet: IP wraps each segment with source 10.10.1.25 and destination 172.16.0.5, and routers forward it hop by hop.
  4. Link: on each network segment, the packet travels inside an Ethernet frame addressed to the next hop’s MAC address.
Diagram of encapsulation in the TCP/IP model as an HTTPS request gains TCP, IP and Ethernet headers

A capture of the TCP handshake looks like this:

09:15:33.120405 IP 10.10.1.25.55210 > 172.16.0.5.443: Flags [S], seq 30214582, win 65535, options [mss 1460]
09:15:33.120510 IP 172.16.0.5.443 > 10.10.1.25.55210: Flags [S.], seq 98452103, ack 30214583, win 28960
09:15:33.120615 IP 10.10.1.25.55210 > 172.16.0.5.443: Flags [.], ack 98452104, win 65535

Line one is the client’s SYN. Line two is the server’s SYN-ACK ([S.]), acknowledging the client’s sequence number plus one. Line three is the client’s ACK. The connection is now established, and the TLS handshake and encrypted HTTP request follow. The mss 1460 option shows the largest TCP payload the client will accept on a standard 1500-byte Ethernet link.

Reading TCP flags like an analyst

TCP flags are one of the fastest ways to understand what a connection, or an attacker, is doing.

What you seeWhat it usually means
SYN, then SYN-ACK, then ACKNormal connection established
SYN, then RST-ACK from the serverPort is closed, or a device actively rejected it
SYN with no reply at allPort is filtered: a firewall silently dropped it, or the host is down
Many SYNs from one source to many portsPort scan (for example, an Nmap SYN scan)
Many SYNs to one port, few or no final ACKsPossible SYN flood filling the server’s connection table
FIN from both sidesNormal, graceful close
Sudden RST in the middle of a sessionApplication crash, timeout, or a security device killing the session
Attack scenario of a SYN flood where many half-open TCP connections exhaust a server

SYN floods and their standard defences, such as SYN cookies, are documented by the IETF in RFC 4987.

Useful filters for finding these patterns:

# Wireshark display filters
tcp.flags.syn == 1 && tcp.flags.ack == 0     # connection attempts only
tcp.flags.reset == 1                         # resets
tls.handshake.type == 1                      # TLS Client Hello (shows SNI)
dns                                          # all DNS traffic

# tcpdump: capture only initial SYN packets on eth0
tcpdump -i eth0 -nn 'tcp[tcpflags] & tcp-syn != 0 and tcp[tcpflags] & tcp-ack == 0'

# Current TCP connections on the host itself
Get-NetTCPConnection -State Established      # Windows PowerShell
ss -tanp                                     # Linux

The Wireshark display filter reference and the tcpdump manual list every field you can filter on.

Investigating the 50 GB transfer, layer by layer

Back to the alert from the start of this article. Work through the layers and write down what each one tells you:

LayerQuestion to answerWhere to look
InternetWhere did the data go? Is the destination IP new, cloud-hosted, or on a threat list?Firewall logs, NetFlow, threat intelligence
TransportWhich port and protocol? One long session or many short ones? How many bytes each way?Firewall session logs, NetFlow byte counts
ApplicationWhich domain or SNI? Does it match the backup vendor? Was there a DNS lookup first?DNS logs, proxy logs, TLS metadata
Host contextWhich process opened the connection? Is a backup job scheduled now?EDR telemetry, change calendar, backup console

If the destination is your known backup provider, on its documented port, started by the backup agent at its scheduled time, it is probably legitimate. If it is a new IP, reached over an unusual port or protocol, by an unexpected process outside any change window, treat it as possible exfiltration. MITRE ATT&CK tracks this behaviour as Exfiltration Over Alternative Protocol (T1048). Your SIEM should correlate these layers for you, so you are not jumping between four consoles at 3 AM.

Detections and controls at each layer

Map of common threats and security controls at each layer of the TCP/IP model
LayerCommon attacksDetection signalsControls
ApplicationPhishing, SQL injection, DNS tunnelingOdd user agents, long random subdomains, HTTP 4xx/5xx burstsWAF, secure web gateway, DNS filtering, email security
TransportPort scans, SYN floods, session hijackingSYN without ACK, many ports from one source, RST stormsStateful firewall, SYN cookies, rate limits
InternetIP spoofing, amplification DDoS, route hijacksImpossible source IPs, unusual TTLs, traffic spikesAnti-spoofing ACLs, DDoS protection, segmentation
LinkARP spoofing, MAC flooding, rogue devicesDuplicate IP warnings, MAC flapping, full MAC tablesDynamic ARP Inspection, port security, 802.1X

Hardening a new network segment, layer by layer

When you build a new segment, add controls at every layer instead of relying on one perimeter firewall:

  • Link: disable unused switch ports, enable port security or 802.1X, and turn on DHCP snooping and Dynamic ARP Inspection.
  • Internet: put users and servers in separate VLANs and subnets, and drop packets on external interfaces that claim an internal source address.
  • Transport: use a stateful firewall with default-deny rules that allow only the ports each application needs.
  • Application: force web traffic through a proxy or secure web gateway, use internal DNS resolvers with filtering, and allow only TLS 1.2 or later.
  • Visibility: send firewall, DNS, proxy and NetFlow logs to the SIEM so you can follow a connection across all four layers.

Troubleshooting with the TCP/IP model

The same layers work for broken connections. Start at the bottom and stop at the first failure:

Flowchart for troubleshooting connectivity through the Link, Internet, Transport and Application layers
  1. Link: is the interface up, and does arp -a show the gateway’s MAC address?
  2. Internet: is the IP configuration correct, and does ping to the gateway and tracert to the destination work?
  3. Transport: does Test-NetConnection server -Port 443 succeed? If not, look for a firewall drop (no reply) or a reset (port closed).
  4. Application: does DNS resolve, does the TLS handshake complete, and what HTTP status does curl -v return?

The OSI troubleshooting guide walks through each of these checks in more detail, with four worked cases.

Frequently asked questions

What is the difference between the TCP/IP model and the OSI model?

OSI has seven layers and is a reference model. TCP/IP has four layers and is what networks actually implement. OSI’s Application, Presentation and Session layers map to TCP/IP’s Application layer, and OSI’s Data Link and Physical layers map to the Link layer.

Does the TCP/IP model have four or five layers?

RFC 1122 defines four. Many textbooks use a five-layer teaching version that separates the physical layer. Both describe the same protocols.

Where does TLS sit in the TCP/IP model?

TLS runs on top of TCP and below application protocols such as HTTP, so in the four-layer model it is part of the Application layer.

Is UDP less secure than TCP?

Neither protocol is secure by itself. UDP is easier to spoof because it has no handshake, which is why it is used in amplification attacks. Security comes from controls such as encryption, authentication and filtering, not from the transport protocol.

Conclusion

The TCP/IP model is the structure behind every log line and packet you investigate. Learn the few header fields that matter at each layer, recognise the common TCP flag patterns, and work through alerts one layer at a time. You will answer the “backup or breach?” question faster, with evidence you can show your team.

Related TechNaga guides

References

2 thoughts on “TCP/IP Model Explained for Security Analysts: 4 Layers, Headers and Real Traffic”

Leave a Comment