RBCloud & DevOpsTHE PRACTICAL LEARNING LIBRARY
By Ravindra BagaleResources

CHAPTER 03 / 60

OSI layers and the TCP/IP model

Use layered thinking to locate failures without memorizing disconnected definitions.

Concept + practical labBy Ravindra Bagale · ~5 min read · lab time additional

Layer mapping

OSI layerFunctionConcrete example
7 ApplicationApplication messagesHTTP request, DNS query
6 PresentationRepresentation and encodingJSON, serialization; encryption is often discussed here
5 SessionConversation coordinationSession establishment concepts
4 TransportEnd-to-end transportTCP segments, UDP datagrams, ports
3 NetworkLogical addressing and routingIPv4 packet, router
2 Data linkLocal-link deliveryEthernet frame, MAC, ARP context
1 PhysicalSignals and mediaCopper, fibre, radio

The TCP/IP model usually groups application, presentation and session into Application; keeps Transport and Internet; and groups the lower layers into Link. Some teaching models split Link into Data Link and Physical, producing five layers. Real protocols do not always fit one box cleanly; TLS is a good example.

Walk through a page load

  1. The browser builds an HTTP request for a hostname.
  2. The transport layer adds TCP information; the network layer adds IP addressing.
  3. The local link encapsulates the packet in a frame for the next hop, often the gateway.
  4. Routers change link headers at each hop; IP TTL decreases. NAT may change IPs and ports.
  5. The destination decapsulates the data and delivers the request to the listening process.

Lab: observe your own traffic

Install tcpdump using your distribution package manager. In one terminal capture DNS packets; in another resolve a name. Stop with Ctrl+C.

bash
sudo tcpdump -ni any port 53 -c 10
getent hosts example.com
ip neigh show
ip route

Encrypted DNS, resolver caching, or /etc/hosts can mean no port-53 packet appears. Browser HTTPS content is encrypted, although endpoints and traffic timing remain observable. Packet captures may contain sensitive material; use a small lab capture rather than collecting unrelated traffic.

Diagnose by layer

A disconnected interface suggests link/physical trouble. No gateway or wrong CIDR suggests network trouble. A reachable IP with a timed-out port suggests transport filtering. An HTTP 404 confirms a working path to an HTTP application but an unmatched resource. A 500 points to application processing, not proof that the network is broken.

Assignment

Draw the route from your laptop to Nginx on EC2. Label DNS resolution, home NAT, internet gateway, security group, TCP port and HTTP response. Explain which headers change at the home router and which address the web application may log behind a proxy.

Official reference

Internet host communication requirements, RFC 1122

Ravindra’s Tip

Layers रटने से ज्यादा useful है failure की layer पहचानना। HTTP 404 आया तो server तक रास्ता बना हुआ है—अब file और routing देखो।

Interview and revision check

What does an HTTP 404 tell you about the network?

An HTTP server responded over the established path. Investigate resource/virtual-host routing before assuming a basic connectivity failure.

Ravindra Bagale · Cloud & DevOps Academy · Handbook and project downloads