The OSI and TCP/IP Models and IP Addressing
Network models give a common language for where protocols, devices and attacks operate. This lesson covers the OSI and TCP/IP models and IPv4 and IPv6 addressing.
Learning outcomes
After completing this lesson, you will be able to:
- Describe the layers of the OSI and TCP/IP models and place protocols, devices and attacks in them.
- Compare IPv4 and IPv6 and the four transmission types.
The OSI model
The Open Systems Interconnection (OSI) model divides communication into seven layers. Each layer provides services to the layer above and adds its own header as data moves down the stack (encapsulation); the receiver removes them going up. The following table lists the layers with their data units, examples and typical attacks.
| Layer | Data unit | Examples | Typical attacks |
|---|---|---|---|
| 7 Application | Data | HTTP, DNS, SMTP, SNMP | Injection, malware, DNS poisoning |
| 6 Presentation | Data | Encoding, compression, TLS encryption | Malformed format attacks |
| 5 Session | Data | Session setup, RPC, NetBIOS | Session hijacking |
| 4 Transport | Segment (TCP), datagram (UDP) | TCP, UDP, ports | SYN floods, port scanning |
| 3 Network | Packet | IP, ICMP, IPsec, routers | IP spoofing, ICMP floods |
| 2 Data link | Frame | Ethernet, MAC, ARP, switches | ARP spoofing, MAC flooding |
| 1 Physical | Bits | Cables, signals, hubs | Wiretapping, jamming |
The following diagram places example attacks and controls at each layer.

Which layer does it attack?
The TCP/IP model and transport protocols
The TCP/IP model has four layers: link (network access, OSI 1-2), internet (OSI 3), transport (OSI 4) and application (OSI 5-7). The Transmission Control Protocol (TCP) is connection-oriented: it uses a three-way handshake (SYN, SYN-ACK, ACK), sequence numbers, acknowledgements and retransmission for reliable, ordered delivery. The User Datagram Protocol (UDP) is connectionless and faster but provides no delivery guarantees, suiting DNS queries, streaming and voice.
A SYN flood sends many SYN packets without completing the handshake, exhausting the server's connection table; SYN cookies are a common defence. Well-known ports identify services, such as 22 for SSH, 53 for DNS, 443 for HTTPS and 3389 for RDP.
Following a single web request through the layers shows how encapsulation works. A browser creates an HTTP request at the application layer, which TLS encrypts. TCP adds a header with source and destination ports, here 443, and sequence numbers, forming a segment. IP adds source and destination addresses, forming a packet. Ethernet adds the hardware addresses of the sender and the next hop, forming a frame, which is transmitted as bits. Each router along the way removes and replaces the Ethernet header but leaves the IP packet intact, and the web server removes each header in turn until the HTTP request remains.
This explains what each security device can see. A switch makes decisions on layer 2 addresses. A traditional firewall filters on layer 3 and 4 information: addresses, protocols and ports. A next-generation firewall or web application firewall looks into the application layer, which it can do for encrypted traffic only if it terminates or inspects the TLS session. Placing an attack or control in the right layer is therefore a practical skill, not only an exam topic.
Encapsulating a web request
IPv4, IPv6 and transmission types
IPv4 uses 32-bit addresses, written in dotted decimal and divided into network and host parts by a subnet mask or CIDR prefix. Private ranges (10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16) are not routed on the internet and are translated by network address translation (NAT). IPv6 uses 128-bit hexadecimal addresses, which removes the need for NAT, replaces ARP with Neighbor Discovery and was designed with IPsec support. Many networks run both (dual stack), and IPv6 traffic that security tools do not inspect can bypass IPv4-only controls.
Unicast sends to a single host. Broadcast sends to all hosts on a segment and exists only in IPv4. Multicast sends to a group of subscribed hosts. Anycast sends to the nearest of several hosts sharing the same address, which DNS root servers and CDNs use for speed and resilience against DDoS attacks.
An addressing example makes CIDR notation concrete. The network 192.168.10.0/24 has a 24-bit network prefix, leaving 8 bits for hosts, which gives 256 addresses, of which 254 can be assigned to hosts because the first identifies the network and the last is the broadcast address. A /26 prefix leaves 6 host bits and 64 addresses. Security teams use this arithmetic when writing firewall rules: a rule that allows 10.0.0.0/8 permits about 16.7 million addresses, which is rarely what was intended for a rule meant to cover one subnet.
IPv6 deserves attention even in networks that do not plan to use it, because most operating systems enable it by default. Devices can communicate over IPv6 on the local network, and tunnelling mechanisms can carry IPv6 traffic across IPv4 networks, so an attacker may be able to use IPv6 paths that firewalls and monitoring tools configured only for IPv4 do not inspect. Either IPv6 is managed with equivalent controls, or it is disabled where it is not needed.
CIDR arithmetic
Placing an attack in the model
An attacker on the same office network sends forged ARP replies so that traffic for the default gateway goes to the attacker's machine. At which OSI layer does the attack operate, and which control addresses it?
ARP maps IP addresses to MAC addresses on the local segment, so ARP spoofing is a layer 2 (data link) attack enabling man-in-the-middle interception. Switch features such as dynamic ARP inspection (with DHCP snooping) and 802.1X port authentication address it, and encryption at higher layers (TLS) protects the content even if traffic is intercepted.
Which transmission type does IPv6 not support?
Show answer
Broadcast; IPv6 uses multicast instead.
Exam Tips
Remember for the exam
- Switches operate at layer 2, routers at layer 3.
- IPv6 has no broadcast and replaces ARP with Neighbor Discovery.
- Monitor IPv6 even where you believe it is unused.
- SYN floods abuse the TCP handshake.