1. IP Addressing: IPv4, Subnets, Public and Private IPs
1.2 IPv4 Structure: Bits, Octets and the Subnet Mask
Aata IPv4 cha aatla structure baghu. He ekda samjla ki CIDR aani subnetting laghech samjel.
An IPv4 address is 32 bits, written as four octets (8 bits each) in dotted-decimal form. Each octet ranges from 0 to 255.
192 . 168 . 1 . 10
11000000 10101000 00000001 00001010
|<-8 bits->|
|<---------------- 32 bits ---------------->|
Total possible IPv4 addresses = 2^32 ≈ 4.3 billion — not enough for today's world of phones, laptops and IoT devices. That is the main reason for NAT, private IPs and IPv6.
Every IPv4 address has two parts:
- Network portion — identifies the network (like the street name).
- Host portion — identifies the device on that network (like the house number).
The subnet mask tells which bits are network and which are host. Example: 255.255.255.0 means the first 24 bits are network bits.
Why this matters for security
Firewalls, security groups and IDS rules all match on the network part of an address. If you misread a mask, you may allow a whole network when you meant one machine – for example writing /16 instead of /32 opens 65,536 addresses instead of one.
Ravindra Bagale's Tip
Binary la ghabru naka! Khup students 8-bit conversion la ghabartat aani subnetting sodun detat. Fakt he aath aakde paathh kara: 128, 64, 32, 16, 8, 4, 2, 1. Konatahi octet hya aakdyanchi berij aahe. Roj paach IPs binary madhe convert kara – ek athvadyat haat basel.
Practice task
Convert 10.20.30.40 and 172.16.5.129 to binary. Then convert 11000000.10101000.00001010.01100100 back to dotted decimal.