मुख्य सामग्री पर जाएं

networking

Subnetting शुरू से: CIDR Notation कैसे Calculate करें

robinhood-projects11 मिनट पढ़ें

IPv4 सबनेट कैलकुलेटर

किसी भी IPv4 CIDR ब्लॉक से नेटवर्क एड्रेस, ब्रॉडकास्ट, उपयोगी होस्ट रेंज, सबनेट मास्क, वाइल्डकार्ड मास्क और होस्ट काउंट कैलकुलेट करता है।

टूल इस्तेमाल करें →

CIDR रेंज एक्सपैंडर

किसी भी CIDR ब्लॉक को उस रेंज के सभी IP एड्रेसेस की पूरी सूची में एक्सपैंड करता है।

टूल इस्तेमाल करें →

Subnet to CIDR Converter

Convert a subnet mask (e.g. 255.255.255.0) to CIDR prefix notation (e.g. /24).

टूल इस्तेमाल करें →

Subnetting शुरू से: CIDR Notation कैसे पढ़ें और Calculate करें

जब भी आप router interface configure करते हैं, firewall rule लिखते हैं, या IP addressing scheme plan करते हैं, आप subnets और CIDR notation के साथ काम कर रहे होते हैं। अगर वे calculations अभी भी थोड़ी uncertain लगती हैं — या आप CCNA, CompTIA Network+ या किसी समान certification के लिए पढ़ रहे हैं — यह guide पूरी process को first principles से walk through करता है। कोई ambiguity नहीं, कोई steps skip नहीं।

IP Address क्या है?

IP address एक 32-bit number है। हर दिन दिखने वाली dotted-decimal notation — 192.168.1.100 — बस उस number को लिखने का human-friendly तरीका है: आठ bits के चार groups, हर एक 0 से 255 के बीच decimal integer के रूप में।

IPv4 Structure: चार Octets, 32 Bits

हर group को octet (आठ bits) कहते हैं। तो 192.168.1.100 पूरी binary में है:

192       168       1         100
11000000  10101000  00000001  01100100

यह 32-bit string वह actual address है जिसके साथ hardware काम करता है। Dotted decimal सिर्फ इसलिए exist करती है क्योंकि humans को 32-bit binary strings याद करने में मुश्किल होती है।

4 Billion Addresses क्यों खत्म हो गए

2^32 = 4,294,967,296। यह बहुत बड़ा लगता है, लेकिन है नहीं — जब हर smartphone, IoT sensor, cloud VM, और home router को address चाहिए। Internet community ने 1990s में exhaustion का अनुमान लगाया और दो solutions design किए: NAT (जो कई devices को एक public IP share करने देता है) और IPv6 (जो 128-bit addresses use करता है)। Subnetting — available address space को छोटे, efficient blocks में divide करना — दूसरा key tool है। यह पुराने classful system की वजह से होने वाली waste को रोकता है जो एक बार में millions के fixed blocks में addresses allocate करता था।

Subnet क्या है?

Subnet (sub-network का short form) एक IP network का logical subdivision है। पूरे organization के लिए 65,536 addresses के एक flat block की बजाय, उस block को छोटे segments में divide करते हैं — हर department, floor, function, या security zone के लिए एक।

Network बनाम Host Portion

हर IP address को simultaneously दो parts में interpret किया जाता है:

  • Network portion — identify करता है कि address किस subnet से belong करता है। Same subnet पर सभी devices इस portion को share करते हैं।
  • Host portion — उस subnet के अंदर individual device को identify करता है।

Subnet mask दोनों के बीच boundary define करता है। Dotted-decimal form में, 255.255.255.0 का मतलब है "पहले 24 bits network portion हैं; आखिरी 8 bits host portion हैं।"

Networks को Subnets में क्यों Divide करते हैं

Subnetting के तीन main benefits हैं:

  1. Traffic isolation — broadcast traffic subnet के अंदर रहता है और पूरे network को flood नहीं करता।
  2. Security segmentation — Firewalls और ACLs subnet boundaries पर operate करते हैं, जिससे zones के बीच traffic restrict कर सकते हैं।
  3. Address efficiency — आप उतने ही host addresses allocate करते हैं जितने हर segment को वास्तव में जरूरत है, बजाय point-to-point link पर /16 waste करने के।

CIDR Notation समझना

CIDR का मतलब है Classless Inter-Domain Routing। इसने 1993 में पुराने classful system (Class A/B/C) को replace किया और अब यह universal है। CIDR notation एक IP address और prefix length को एक single string में combine करता है:

192.168.1.0/24

Slash के बाद की number prefix length है — कितने bits, left से गिने, network portion से belong करते हैं।

/24 (Prefix Length) का क्या मतलब है

/24 का मतलब है कि पहले 24 bits network हैं। चूँकि total 32 bits हैं, hosts के लिए 8 bits बचते हैं।

  • 8 host bits → 2^8 = 256 addresses block में
  • 2 subtract करें (network address + broadcast) → 254 usable host addresses

/25 में 7 host bits बचते हैं: 2^7 = 128 addresses, 126 usable।
/30 में 2 host bits बचते हैं: 2^2 = 4 addresses, 2 usable — point-to-point link के लिए minimal block।

Slash Notation और Dotted-Decimal Mask के बीच Convert करना

32 bits लिखें। पहले n bits (जहाँ n prefix length है) को 1s से fill करें, और बाकी bits को 0s से। फिर उन्हें decimal में चार octets के रूप में पढ़ें।

/24 के लिए:

11111111 11111111 11111111 00000000
   255      255      255       0

Subnet mask: 255.255.255.0

/22 के लिए:

11111111 11111111 11111100 00000000
   255      255      252       0

Subnet mask: 255.255.252.0

Reverse — mask को slash notation में convert करना — बस 1-bits count करना है। FileCrank का Subnet to CIDR Converter → इसे instantly करता है।

Subnet को Hand से कैसे Calculate करें

Arithmetic को एक बार खुद करने से concept उस तरह से cemented होता है जो tools का output अकेले कभी नहीं कर सकता। यहाँ systematic process है।

Step 1 — Binary में Convert करें

IP address लें और सभी 32 bits लिखें। 172.16.5.0 के लिए:

172       16        5         0
10101100  00010000  00000101  00000000

Step 2 — Network और Host Bits Identify करें

/22 prefix के साथ, पहले 22 bits network portion हैं और आखिरी 10 bits host portion हैं। Bit 22 पर line draw करें:

10101100 00010000 000001 | 01 00000000
<---------- network (22 bits) ----> <-- host (10 bits) -->

Notice करें कि split तीसरे octet के बीच में fall होता है। यही subnetting में ज़्यादातर confusion का source है — boundary को octet boundary पर align होना जरूरी नहीं।

Step 3 — Network Address, Broadcast, Usable Range Find करें

  • Network address: सभी host bits को 0 पर set करें।
    10101100 00010000 00000100 00000000  →  172.16.4.0
    
  • Broadcast address: सभी host bits को 1 पर set करें।
    10101100 00010000 00000111 11111111  →  172.16.7.255
    
  • Usable range: network address + 1 से broadcast - 1 तक। 172.16.4.1 से 172.16.7.254

Worked Example: 172.16.5.0/22

PropertyValue
Network address172.16.4.0
Subnet mask255.255.252.0
Wildcard mask0.0.3.255
Broadcast172.16.7.255
First usable host172.16.4.1
Last usable host172.16.7.254
Total host addresses1,024
Usable host addresses1,022

Notice करें कि input address 172.16.5.0 subnet के अंदर एक host address है — उस /22 block का network address 172.16.4.0 है। यह common exam trick है: दिया गया address हमेशा network address ही नहीं होता।

Tip: अपने hand calculations को immediately FileCrank के IPv4 Subnet Calculator → से verify करें। 172.16.5.0/22 paste करें और harder exercises पर जाने से पहले confirm करें कि सभी छह values match करती हैं।

एक नज़र में Common Subnet Sizes

PrefixSubnet MaskTotal AddressesUsable HostsTypical Use
/8255.0.0.016,777,21616,777,214Large enterprise, ISP
/16255.255.0.065,53665,534Enterprise campus
/20255.255.240.04,0964,094Large department
/22255.255.252.01,0241,022Medium department
/24255.255.255.0256254Small LAN, सबसे common
/25255.255.255.128128126/24 split
/26255.255.255.1926462Small segment
/27255.255.255.2243230Server VLAN
/28255.255.255.2401614Small cluster
/30255.255.255.25242Point-to-point link

/24 practice में अब तक सबसे common है क्योंकि 254 hosts ज़्यादातर VLANs के लिए सही size है, और arithmetic trivial है (host portion हमेशा last octet होता है)।

FileCrank Subnet Calculator Use करना

Day-to-day work के लिए — firewall rules लिखना, address allocation plan करना, config verify करना — आपको हाथ से binary arithmetic करने की ज़रूरत नहीं। FileCrank के IPv4 Subnet Calculator → में कोई भी IP address prefix length के साथ enter करें और यह instantly network address, broadcast, usable range, subnet mask, wildcard mask, और host count return करता है।

अगर CIDR block के अंदर हर individual IP address देखनी हो — whitelists configure करने या allocations audit करने में useful — CIDR Range Expander → सभी list करता है। दोनों tools पूरी तरह आपके browser में run होते हैं: कोई data आपके device से बाहर नहीं जाता, कोई account required नहीं।

सभी subnet और CIDR utilities को एक जगह quickly access करने के लिए, networking tools → hub सभी 24 tools list करता है।

VLSM क्या है और Certification Candidates के लिए यह क्यों मायने रखता है?

Variable Length Subnet Masking (VLSM) basic subnetting को extend करता है, जिससे same network के अंदर different subnets को different prefix lengths use करने देता है। /24 को चार equal /26s (62 usable hosts each) में carve करने के बजाय, VLSM आपको exactly उस block size को allocate करने देता है जिसकी हर segment को ज़रूरत है।

Example: आपके पास 10.0.0.0/24 है जिसे चार segments में distribute करना है:

SegmentHosts neededAllocated blockPrefix
Engineering10010.0.0.0/25 (126 hosts)
Sales5010.0.0.128/26 (62 hosts)
Management2010.0.0.192/27 (30 hosts)
Point-to-point210.0.0.224/30 (2 hosts)

VLSM address waste minimize करता है और CCNA और Network+ exams पर heavily tested होता है। Examiners जो key skill test करते हैं वह है: requirement (number of hosts) दिए जाने पर, उसे satisfy करने वाला smallest prefix identify करें, फिर address space से non-overlapping blocks order में allocate करें।

CCNA और Network+ दोनों exam simulations आपको fixed address pool देते हैं और आपसे simultaneously multiple requirements के लिए subnet करने को कहते हैं — VLSM ही एकमात्र practical approach है। Hand calculations से practice करना और IPv4 Subnet Calculator → से verify करना fluency बनाने का सबसे तेज़ तरीका है।

अक्सर पूछे जाने वाले प्रश्न

Subnet mask और wildcard mask में क्या अंतर है?

Subnet mask में network portion में 1s और host portion में 0s होते हैं। Wildcard mask इसका bitwise inverse है — network portion में 0s और host portion में 1s। Wildcard masks Cisco ACLs और OSPF network statements में use होते हैं। /24 के लिए, subnet mask 255.255.255.0 है और wildcard 0.0.0.255 है।

"Host bits all zero" और "host bits all one" का क्या मतलब है?

जब सभी host bits 0 हों, address network address है — subnet itself को identify करता है और किसी device को assign नहीं किया जा सकता। जब सभी host bits 1 हों, address broadcast address है — यहाँ भेजे गए packets subnet पर हर host को deliver होते हैं। दोनों को host address के रूप में use नहीं किया जा सकता।

क्या दो subnets overlap कर सकते हैं?

नहीं। Overlapping subnets routing ambiguity cause करते हैं: router determine नहीं कर सकता कि packet किस interface से forward करे। हमेशा verify करें कि newly allocated blocks में already-in-use addresses नहीं हैं — यह check करके कि उनके ranges intersect नहीं होते।

Point-to-point link पर सबसे छोटा subnet क्या use करना चाहिए?

/30 (4 addresses: network, two hosts, broadcast) traditional choice है। /31 (RFC 3021) बिना network या broadcast के exactly 2 addresses provide करता है — ज़्यादातर modern IOS/NX-OS versions में point-to-point use के लिए valid और generally preferred क्योंकि कोई addresses waste नहीं होते।

Subnet mask को CIDR notation में कैसे convert करें?

Mask के binary representation में contiguous 1-bits count करें। 255.255.255.0 = 24 ones = /24। 255.255.252.0 = 22 ones = /22। FileCrank का Subnet to CIDR Converter → यह one step में करता है।

मेरा router /32 के साथ "host route" क्यों दिखाता है?

/32 में zero host bits हैं — यह एक network नहीं, बल्कि एक single specific address का route है। Routers /32 host routes use करते हैं individual addresses के लिए specific next-hops force करने के लिए (BGP, loopback interfaces, और policy-based routing में common)।