Ravindra BagaleCourses & study guides

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

Don't be afraid of binary! Many students are scared of 8-bit conversion and give up on subnetting. Just memorise these eight numbers: 128, 64, 32, 16, 8, 4, 2, 1. Every octet is a sum of these numbers. Convert five IPs to binary every day – within a week you'll have the hang of it.

Practice task

Convert 10.20.30.40 and 172.16.5.129 to binary. Then convert 11000000.10101000.00001010.01100100 back to dotted decimal.