When troubleshooting, its best practice to think in terms of the OSI layer model to identify which layer the problem is in, then go a layer deeper

  1. Physical layer (transmits raw bit stream over the physical medium)
  2. Data link layer (physical addressing, frames)
  3. Network layer (path determination, logical addressing, packets, routing)
  4. Transport layer (end to end connection)
  5. Session layer (synch and send to port)
  6. Presentation layer (syntax layer)
  7. Application layer (end user layer)

OSI has 7 layers and is a theoretical model; TCP/IP has 4 layers and is practical, used in real networking

image.png

Notes

Take note that the OSI model is more of a theoretical model and it is very useful in the learning process. On the other hand, the Internet was built on the TCP/IP model

Untitled

Differences between the two models are: TCP/IP combines the three upper layers of the OSI model in a single layer and the data link and physical layers from the OSI model are combined in a single layer

Layer 3 (IP/Network) is like the street address, it tells you which house (IP address) to deliver to. Layer 4 (TCP/UDP + Ports) is like the door of the house, port 443 is the front door, port 22 is the back door, port 25 is the mail slot. TCP vs UDP is like the difference between a door with a bell and a confirmed handshake. Layer 7 (Application) is reading the letter inside the envelope

So regarding firewalls, a Layer 3 firewall rule says: "no deliveries to this street." A Layer 4 rule says: "deliveries to this street are fine, but only through the front door." A Layer 7 rule says: "you can knock on the front door, but I'm opening the envelope first — and if I don't like what's written inside, you're turned away.”

Here’s what happens when a client communicates with a server through HTTPS step by step

image.png

1. Browser parses the URL — It sees https (use TLS), example.com (the host), and / (the path). This is purely Layer 7 (Application).

2. DNS resolution — The browser needs an IP address. It checks its cache, then asks the OS, then a resolver, which walks the DNS tree (root → .comexample.com) until it gets 93.184.216.34. This uses UDP on port 53, still Layer 7 but carried over Layer 4.