Ravindra BagaleCourses & study guides मराठी Track your progress

1. IP Addressing: IPv4, Subnets, Public and Private IPs

1.3 IPv4 Classes (A to E) and Loopback

Classes aata "historical" aahet, pan interview madhe hamkhas vichartat – Deloitte sarkhya companies madhe candidates ni "class C cha subnet mask kay?" ha prashna report kela aahe. Mhanun he table paathh kara.

Class First octet range Leading bits Default mask Networks / Hosts per network Use
A 1 – 126 0 255.0.0.0 (/8) 126 / ~16.7 million Very large networks
B 128 – 191 10 255.255.0.0 (/16) 16,384 / 65,534 Medium networks
C 192 – 223 110 255.255.255.0 (/24) ~2 million / 254 Small networks
D 224 – 239 1110 — — Multicast
E 240 – 255 1111 — — Experimental / reserved

What about 127?

127.0.0.0/8 is reserved for loopback. 127.0.0.1 (also called localhost) always means "this same machine". When an app listens on 127.0.0.1:3000, it is reachable only from the server itself — that is exactly what we want behind a reverse proxy.

Why this matters for security

Recognising special ranges quickly is a daily SOC skill. Traffic from 127.0.0.1 in a web log means the request came from the server itself (for example a reverse proxy) – but it can also be a sign of SSRF, where an attacker tricks the server into calling itself. Services listening only on 127.0.0.1 are not reachable from outside, which is exactly how we will protect MySQL later.

Ravindra Bagale's Tip

Many students write the Class A range as 0–127. Remember: 0 and 127 are special, so the usable Class A range is 1–126. And 127 means loopback – "this same machine". In an interview, this small point makes you stand out.

Practice task

Identify the class and default mask of: 10.4.5.6, 172.20.1.1, 200.1.2.3, 230.0.0.5, 127.0.0.1.

Extended teaching notes

Why this lesson matters

Use this lesson to strengthen systems you own: understand the risk, practise safely in a lab, then write and apply the fix.

Apply the fix across stacks

Same class of bug, same idea in every language.

Java / Spring Boot

Parameterise queries, encode output, CSRF tokens, limited Actuator, dependency scanning.

ASP.NET Core

EF Core / parameterised SQL, Razor encoding, HTTPS, Data Protection.

Node.js / Express

helmet, parameterised SQL, npm audit, avoid eval and shell concat.

Python / Django / Flask / FastAPI

ORM, autoescape, pip-audit, Bandit; never shell=True with user input.

PHP / Laravel

PDO/Eloquent, Blade escaping, composer audit.

Go / Ruby

database/sql placeholders / ActiveRecord; html/template / ERB escaping; govulncheck / Brakeman.

nginx / Apache / Tomcat

Hide versions, TLS, security headers, least-open ports.

MySQL / PostgreSQL / MongoDB / Redis

Private networks, auth on, least-privilege users, no 0.0.0.0/0.

AWS / Azure / GCP

Roles not long-lived keys, private data stores, cloud audit logs on.

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)

  1. Write the lesson title, date and the exact lab target you are allowed to use.
  2. List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
  3. Run one safe check from the lesson on a lab system only. Paste the command and output.
  4. Write a two-sentence fix you would give a teammate.
  5. 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.