WHY dotted decimal? 32 raw bits (11000000101010000000000100000001) are unreadable. We split into 4 groups of 8 bits and write each group in decimal. 192.168.0.1 is just human-friendly packaging.
WHY the "−2"? In any network the all-zeros host = the network address itself, and the all-ones host = the broadcast address. Neither can be assigned to a real machine.
Imagine every computer is a house and its address is a long number. The first part of the number is the street name (the network) and the last part is the house number (the host). The mailman (router) only needs to know streets, not every house — so he just reads the front part. A /24 means "the first 24 digits are the street, the rest are houses." When a street has too many houses, we split it into smaller streets by treating a few more digits as part of the street name — that's subnetting. CIDR just lets us cut the street/house line anywhere we want instead of at fixed spots, so we don't waste house numbers.
How many bits is an IPv4 address?
32 bits, written as 4 octets (dotted decimal), each 0–255.
Dekho, IPv4 address basically ek 32-bit number hai jo har device ko Internet par unique pehchaan deta hai — bilkul ghar ke address jaisa. Hum ise padhne layak banane ke liye 4 octets mein todte hain (192.168.0.1), aur har octet 0 se 255 tak hota hai kyunki 8 bits ka max 28−1=255 hota hai. Pura address 232 yaani lagभग 4.3 billion combinations deta hai — aur yahi scarcity poori kahani ka root hai.
Address ke do hisse hote hain: network part (kaunsa network) aur host part (us network ke andar kaunsa device). Router sirf network part dekh kar route karta hai, isliye usse har device yaad rakhne ki zaroorat nahi padti. Pehle classes (A, B, C) fixed split dete the, lekin wo bahut waste karte the — 2000 hosts ke liye poori Class B (65k) leni padti thi. Isliye CIDR aaya, jisme aap /n likh kar network/host line kahin bhi kaat sakte ho.
Subnetting ka funda simple hai: ek bade network se kuch host bits udhaar lo network banane ke liye. Agar s bits borrow karo to 2s subnets bante hain, aur agar h host bits bachein to har subnet mein 2h−2 usable hosts (minus 2 isliye kyunki all-zeros = network address aur all-ones = broadcast, ye dono kisi machine ko nahi de sakte). Block size=2h ko yaad rakho — subnet ki network addresses hamesha is block size ke multiples par hi aati hain, isse boundaries instantly mil jaati hain. Exam aur real networking dono mein yahi 80/20 trick kaam aati hai.