Join our Newsletter — 33% off our NHI Course
Home› Guides› TCP/IP and the OSI Model for Beginners: The…
Guide Network Security

TCP/IP and the OSI Model for Beginners: The network layers explained and why defenders use them

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 1 December 2026 11 min read
On this page

The OSI model and TCP/IP split network communication into layers, each doing one job.

This guide is for people starting out in IT or security, and for anyone who keeps hearing "layer 7" or "layer 3" in meetings. You do not need to set up a network. The layers are a shared map that helps teams say where a problem or an attack sits.

In short

  • The OSI model has seven layers. It is a teaching and troubleshooting map, not a working system.
  • TCP/IP is the set of rules the internet really uses, usually shown as four layers.
  • Each layer wraps the data from the layer above in its own label before sending it on.
  • Defenders use the layers to name where an attack happens and which control belongs there.

What you will learn

  • Name the seven OSI layers and the four TCP/IP layers.
  • Explain how data is wrapped and unwrapped as it moves through the layers.
  • Describe how TCP and UDP differ.
  • Match a common attack and a common control to the right layer.
Agreed set of rules (protocol)
a shared way for devices to format and send data so both ends understand it.
Job level (layer)
one step in the stack, with its own job and its own protocols.
Reliable delivery rules (TCP)
a protocol that checks data arrives complete and in order.

What are the OSI and TCP/IP models?

Think of a parcel packed in boxes inside boxes. Each packer adds an outer box with its own label. At the other end, each box is opened in reverse order until the gift is reached. Network layers work the same way.

The OSI model is a map made by a global standards body. It splits network communication into seven layers, from cables at the bottom to apps at the top [1].

TCP/IP is the group of protocols the internet runs on, also called the internet protocol suite. It is often shown as four layers: application, transport, internet and link [2]. The modern internet follows this simpler model more closely than OSI [1].

Where the comparison stops working: boxes are packed once. Network layers wrap and unwrap data many times a second, and some boxes are rewritten at each stop on the way.

Why does it matter?

The layers give everyone a shared language. "It is a layer 7 problem" tells a colleague to look at the app, not the cables.

If you are new to IT or security work

What could happen: you are asked about the layers in an interview or a meeting and cannot place an issue on the map.

Check this: practise naming the layer for things you already know, such as Wi-Fi, IP addresses and websites.

Next: CompTIA Network+ for Beginners

If you buy security tools

What could happen: you buy a tool that guards one layer and assume it covers them all.

Check this: ask each supplier which layers its product can see and which it cannot.

Next: Web Application Firewalls for Beginners

If you look after a small network

What could happen: you troubleshoot the app for hours when the fault is a loose cable.

Check this: work up from the bottom layer: cable or Wi-Fi first, then addresses, then the app.

Next: Networking Fundamentals for Beginners

What does it look like?

Here is a made-up view of one message, unwrapped layer by layer. Tools that capture network traffic show a similar breakdown.

Example only. All values are made up.

Frame    from 00:00:5e:00:53:00 to 00:00:5e:00:53:ff   (1)
 Packet   from 192.0.2.10 to 198.51.100.25              (2)
  Segment TCP from port 50000 to port 443               (3)
   Data   [encrypted with TLS, FAKE contents]           (4)
    Request GET /EXAMPLE-page on shop.example.com       (5)
  1. Link layer: the hardware addresses of two devices on the same local network.
  2. Internet (network) layer: the IP addresses of the sender and the far-away receiver.
  3. Transport layer: TCP, with port numbers that say which program should get the data.
  4. Encryption: TLS scrambles everything above this line while it travels.
  5. In a real file, this line would contain the web request that the app sends, only visible after decryption.

Why this is risky: without the encryption at note 4, anyone on the path could read the request in note 5.

The safer way: use encrypted connections, so the outer labels show where data goes but not what it says.

How does it work?

  1. The app creates the data. A browser writes a web request using an application layer protocol, such as HTTP [1].
  2. The transport layer splits and labels it. It breaks the data into segments for end-to-end delivery. TCP checks that pieces arrive in order and asks for missing ones again [1][3].
  3. The internet layer adds addresses. It turns segments into packets with IP addresses and finds a path between networks [1][2].
  4. The link layer moves it one hop. It packs packets into frames for the next device on the same local network [1].
  5. The receiver unwraps it. Each layer at the other end removes its label and passes the rest up, until the app gets the request.
Diagram titled The layers, side by side. On the left, the seven OSI layers from top to bottom: 7 Application, 6 Presentation, 5 Session, 4 Transport, 3 Network, 2 Data link, 1 Physical. In the middle, the four TCP/IP layers lined up against them: Application covers OSI 5 to 7, Transport matches 4, Internet matches 3, Link covers 1 and 2. On the right, examples of what lives at each TCP/IP layer: HTTP, DNS and email at Application; TCP and UDP at Transport; IP addresses and routers at Internet; Wi-Fi, cables and hardware addresses at Link.
Figure 1. The seven OSI layers and the four TCP/IP layers describe the same journey at different levels of detail.

TCP sets up a connection first with a three-step greeting, called the handshake, and then sends the data [3]. UDP skips that setup and does not resend lost pieces. That makes it quicker for calls, games and name lookups (DNS), where speed matters more than every packet [4].

Defenders use the same map for attacks and controls. Some flooding attacks aim at layers 3 and 4, and others at layer 7, the app [1]. A tool can only judge what it can see at its layer.

Diagram titled Attacks and controls by layer, a table with four rows for the TCP/IP layers. Application: example problems are attacks on web forms and floods of web requests; example controls are a web application firewall that filters web traffic and keeping apps updated. Transport: example problems are floods of connection requests and open ports nobody needs; example controls are a firewall that checks ports and closing unused ports. Internet: example problems are floods aimed at an address and traffic sent the wrong way; example controls are firewall rules on IP addresses and routing checks. Link: example problems are someone on the same local network pretending to be another device (ARP spoofing); example controls are controlling who can join the network and splitting it into parts. A green bar says TLS encryption keeps the content private while the lower layers carry it.
Figure 2. Each layer has its own typical problems and its own controls.

For example, a classic firewall looks at the IP addresses and port numbers in packet labels [5]. A web application firewall looks at the web traffic itself [6]. At the link layer, ARP spoofing lets someone on the same local network place themselves in the middle of other devices' traffic [7]. TLS encryption adds privacy and checks that data was not changed [8].

A worked example

Idris Vance has just joined a small IT support team. On his second day, the office says the booking system is "down". His manager asks him to find out which layer the problem is on.

Idris starts at the bottom, as he learned. Link layer: his laptop shows a Wi-Fi connection, and other staff can reach email. So the local network seems fine.

Internet layer: he checks that his laptop has an IP address, and he can reach other sites. Routing to the outside world seems fine too.

Transport layer: he asks a senior colleague to check the booking server. The server is up, but the firewall shows that port 443, used for secure web traffic, was closed in a change made last night. Connections never reach the app.

The colleague reopens the port through the normal change process, with approval and a note in the change log. The booking system loads again.

At the team review, Idris sums it up in one line. It was a transport layer block at the firewall, not an app fault. The developers did not need to be woken up, because the layers pointed to the right team.

The manager adds one step to the change checklist: test the service from outside after every firewall change. Idris adds the layers to his interview notes too. He now has a real story to tell when someone asks him to explain the OSI model.

Myths and mistakes

What people thinkWhat is true
The internet runs on the OSI model.The internet runs on TCP/IP. OSI is a map used for teaching and troubleshooting.
A firewall protects against every attack.A classic firewall sees addresses and ports. Attacks hidden inside allowed web traffic need other controls.
UDP is unsafe and TCP is safe.Both are delivery rules, not security tools. Security comes from encryption and other controls on top.
You must memorise all seven layers word for word.Knowing what each layer does matters more than the exact names.

What can I do this week?

  • Write the seven OSI layers and the four TCP/IP layers side by side from memory.
  • Place five things you use daily on the map, such as Wi-Fi, an IP address, a port, a website and email.
  • Ask your team which layers your firewall and other security tools can see.
  • Next time something breaks, check from the bottom layer up and note where it failed.

Checklist

  • I can explain why there are two models.
  • I can name the four TCP/IP layers.
  • I can explain how data is wrapped and unwrapped.
  • I know the main difference between TCP and UDP.
  • I can place a firewall and a web application firewall on the map.
  • I know which layer ARP spoofing works at.
  • I troubleshoot from the bottom layer up.

Common questions

Which model should I learn first?

Learn both, side by side. TCP/IP is what the internet really uses, so it explains how traffic moves. OSI has more layers and is the common language in job adverts, interviews and vendor material. Knowing how they line up lets you use either.

What does "layer 7" mean?

It means the application layer of the OSI model, where apps such as browsers and email talk. A "layer 7 attack" targets the app itself. One example is flooding a website with requests that look normal.

Where does HTTPS sit?

HTTPS is web traffic (HTTP) carried inside TLS encryption. HTTP is an application layer protocol, and TLS sits just beneath it. TLS scrambles the web data and checks it was not changed. The lower layers then carry it without showing what it says.

Why do security people care about layers?

Because each control can only see certain layers. Naming the layer of an attack tells you which tool should catch it and which team should fix it. It also shows gaps, where no tool is watching.

Where next?

Ready for the detail? Read the practitioner guide: OSI and TCP/IP Models Guide. It goes further into encapsulation, a layer-by-layer table of attacks and controls, and where tools such as VPNs and network detection sit.

Also useful:

Related NHI Mgmt Group resources: TLS and HTTPS for Beginners, Network Security for Beginners and Network Security Engineer Interview Questions.

Key terms

OSI model
A seven-layer map of network communication, used for teaching and troubleshooting.
TCP/IP (internet protocol suite)
The set of protocols the internet runs on, usually shown as four layers.
TCP
A transport protocol that sets up a connection and checks data arrives complete and in order.
UDP
A transport protocol that sends data without setting up a connection or resending lost pieces.
IP address
A number that identifies a device so packets can be delivered to it.
Port
A number that tells a device which program should receive incoming data.
Firewall
A filter that allows or blocks traffic based on rules.

Sources and further reading

  1. Cloudflare, "What is the OSI Model?", Cloudflare Learning Center. https://www.cloudflare.com/learning/ddos/glossary/open-systems-interconnection-model-osi/ (accessed 1 Dec 2026).
  2. R. Braden (ed.), "Requirements for Internet Hosts: Communication Layers", RFC 1122, IETF, October 1989, section 1.1.3. https://www.rfc-editor.org/rfc/rfc1122 (accessed 1 Dec 2026).
  3. Cloudflare, "What is TCP/IP?", Cloudflare Learning Center. https://www.cloudflare.com/learning/ddos/glossary/tcp-ip/ (accessed 1 Dec 2026).
  4. Cloudflare, "What is UDP?", Cloudflare Learning Center. https://www.cloudflare.com/learning/ddos/glossary/user-datagram-protocol-udp/ (accessed 1 Dec 2026).
  5. Cloudflare, "What is a firewall?", Cloudflare Learning Center. https://www.cloudflare.com/learning/security/what-is-a-firewall/ (accessed 1 Dec 2026).
  6. Cloudflare, "What is a WAF?", Cloudflare Learning Center. https://www.cloudflare.com/learning/ddos/glossary/web-application-firewall-waf/ (accessed 1 Dec 2026).
  7. Imperva, "What is ARP Spoofing", Imperva Learning Center. https://www.imperva.com/learn/application-security/arp-spoofing/ (accessed 1 Dec 2026).
  8. Cloudflare, "What is TLS (Transport Layer Security)?", Cloudflare Learning Center. https://www.cloudflare.com/learning/ssl/transport-layer-security-tls/ (accessed 1 Dec 2026).

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.