Chapter 2: The OSI Model and TCP/IP Model
Come on, friends, first let's understand why we need a layered model. When something breaks in production, a good engineer does not panic – they check layer by layer. This chapter will give you exactly that way of thinking. When a dairy brand like Amul (sample data, for practice) calls to say "our website won't open", you will also search layer by layer. It's very simple – just stay with me.
चला मित्रांनो, आधी समजून घेऊया की लेयर्ड मॉडेल का लागतं. प्रोडक्शनमध्ये काही तुटलं की चांगला इंजिनिअर घाबरत नाही – तो लेयर बाय लेयर चेक करतो. हा चॅप्टर तुम्हाला हीच विचार करण्याची पद्धत देईल. Amul-style dairy (सॅम्पल डेटा, सरावासाठी) चा फोन आला की "आमची वेबसाइट उघडत नाही", तर तुम्ही पण असेच लेयर्सप्रमाणे शोधाल. एकदम सिंपल आहे, फक्त माझ्यासोबत राहा.
चलो दोस्तों, पहले समझते हैं कि लेयर्ड मॉडल क्यों चाहिए. प्रोडक्शन में कुछ टूटा तो अच्छा इंजीनियर घबराता नहीं – वो लेयर बाय लेयर चेक करता है. ये चैप्टर आपको यही सोचने का तरीका देगा. Amul-style dairy (सैंपल डेटा, सिर्फ़ अभ्यास के लिए) का फ़ोन आया कि "हमारी वेबसाइट नहीं खुल रही", तो आप भी ऐसे ही लेयर्स के हिसाब से ढूँढोगे. बिल्कुल सिंपल है, बस मेरे साथ रहो.
What you will learn in this chapter
- Why we need a layered model
- The seven OSI layers and PDUs
- TCP vs UDP and encapsulation
- OSI vs TCP/IP model
- Where AWS services sit
- What happens when you open a site
Concepts in this chapter
- 2.1Why do we need a reference model?
- 2.2The seven layers
- 2.3The TCP/IP model and comparison
- 2.4Walk-through: what happens when you open a website?
Review and practice
Extended teaching notes
Why this lesson matters
Cloud security is mostly IAM, network exposure, logging and secure defaults. The shared responsibility model means the provider patches the metal; you patch what you configure.
- No public databases or public admin panels.
- Roles / OIDC instead of long-lived access keys.
- CloudTrail / Activity Logs / Audit Logs on and retained.
- S3/Blob/GCS: Block Public Access; encrypt; least privilege.
Mini case study
Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.
Defender's worksheet (do this today)
- Write the lesson title, date and the exact lab target you are allowed to use.
- List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
- Run one safe check from the lesson on a lab system only. Paste the command and output.
- Write a two-sentence fix you would give a teammate.
- Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.
Indian workplace (sample data)
Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).
Global practice
Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.
Everyday analogy
Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.
Key terms
- Control: a safeguard (patch, config, process, detection).
- Finding: a weakness backed by evidence.
- Remediation: the fix plus how you verified it.
- Scope: systems you have written permission to touch.
- Least privilege: only the access the task needs.
- Defence in depth: several layers so one failure does not end the story.
Common mistakes
- Skipping written permission "just for a quick scan".
- Practising on hostel, office or public targets without authorisation.
- Collecting tool output without writing the fix.
- Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
- Publishing screenshots that contain secrets, cookies or internal hostnames.
Recap
- Evidence, fix, owner, date.
- Own lab only.
- Fix > spectacle.
Extra depth
Re-read the original short section at the top of the page, then this expansion. Together they should exceed a solid lesson length. If anything still feels thin, add your own lab screenshot and a paragraph in your notebook — that personal evidence is what interviews ask for.
- Permission before tools.
- Patch and config before exploits.
- Logs and backups before blame.
- Teach one junior the warning from this page.
Practice Tasks
Sangli Turmeric Traders is a spice trading business in Sangli. Dattatray Chavan looks after its IT and cloud work. They count money in INR and run their AWS resources in the ap-south-1 Region. In the tasks below you do real jobs for them using what this lesson teaches. All names, account IDs, IP addresses and numbers are made up for practice.
0 / 12
Easy How many addresses in a /16?
Why: Picking a VPC size needs this count.
What to do: Sangli Turmeric Traders plans the VPC 10.204.0.0/16. How many IP addresses does it hold in total?
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Easy Create a VPC
Why: A VPC is your own private network in AWS. Everything else lives inside it.
What to do: Create a VPC with the CIDR block 10.6.0.0/16.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Easy Test a website from the server
Why: curl shows whether the web server answers, even before DNS is ready.
What to do: Request http://localhost and show only the response headers.
- Find the Linux command that does this job.
- Add the options (like -r or -h) the task needs.
- Add the file names, folders or users in the right order.
- Use sudo if the job changes system files or users. Click Check answer.
Medium First usable IP for a server
Why: The first 4 addresses are reserved by AWS.
What to do: What is the first IP address a server can get in 10.204.20.0/24 on AWS?
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Medium Find the VPC router address
Why: AWS reserves base+1 for the router.
What to do: Which address does AWS reserve for the VPC router in subnet 10.204.4.0/24?
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Medium Usable IPs in an AWS /24 subnet
Why: AWS keeps 5 addresses in every subnet.
What to do: How many addresses can Sangli Turmeric Traders use for servers in subnet 10.204.1.0/24 on AWS?
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Medium Usable IPs in a /28
Why: /28 is the smallest AWS subnet.
What to do: Subnet 10.204.9.0/28 on AWS. How many usable IPs?
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Medium Create a subnet in one AZ
Why: Subnets split the VPC range and each one lives in exactly one AZ.
What to do: In vpc-0ef35315aedeadbee, create subnet 10.6.1.0/24 in ap-south-1a.
- Read the task and decide which AWS service it is about.
- Write aws, then the service name, then the operation (the action word).
- Add each needed flag (--name) followed by its value from the task.
- Flags can be in any order. Click Check answer.
Medium Do these VPCs overlap?
Why: Peering fails when ranges overlap.
What to do: Can VPC 10.204.0.0/16 peer with VPC 10.204.128.0/17? Answer yes or no.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Hard Range of a /26
Why: Knowing the range stops subnets from overlapping.
What to do: Write the first and last address of 10.204.3.64/26 (like a.b.c.d - e.f.g.h).
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Hard Pick the smallest prefix
Why: Right-sizing saves address space.
What to do: A subnet must hold 100 servers on AWS. What is the largest prefix number (smallest subnet) that fits? Answer like /25.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.
Hard Split a /24 into two
Why: Public and private subnets often split one block.
What to do: Split 10.204.8.0/24 into two equal subnets. Write both CIDRs separated by a comma.
- Write down the numbers the task gives you.
- Work it out step by step on paper.
- Type only the final answer in the box.
- Click Check answer.