Data Communication and Networking

IP Address Classes; Subnetting and CIDR

C-CAT

IP Address Classes

Classful Addressing

IPv4 addresses are divided into 5 classes (A, B, C, D, E):

ClassFirst Octet RangeNetwork BitsHost BitsDefault Subnet Mask# NetworksHosts per Network
A1 – 126824255.0.0.0 (/8)12616,777,214
B128 – 1911616255.255.0.0 (/16)16,38465,534
C192 – 223248255.255.255.0 (/24)2,097,152254
D224 – 239N/AN/AN/A—Multicast
E240 – 255N/AN/AN/A—Research/Reserved

Note: 127.x.x.x is reserved for loopback (127.0.0.1 = localhost)

Binary Class Identification

ClassFirst BitsFirst Octet Range
A0xxxxxxx0 – 127
B10xxxxxx128 – 191
C110xxxxx192 – 223
D1110xxxx224 – 239
E1111xxxx240 – 255

Quick identification rule:

0xxxxxxx → Class A (starts with 0)
10xxxxxx → Class B (starts with 10)
110xxxxx → Class C (starts with 110)
1110xxxx → Class D (starts with 1110)
1111xxxx → Class E (starts with 1111)

Net ID and Host ID

Every IP address has two parts:

  • Net ID (Network ID) — identifies the network
  • Host ID — identifies the specific device within the network
Class A: |  Net ID  |        Host ID          |
         | 8 bits   |       24 bits            |
         | 1 octet  |       3 octets           |

Class B: |     Net ID      |   Host ID         |
         |    16 bits      |   16 bits
|
         |    2 octets     |   2 octets        |

Class C: |         Net ID          | Host ID  |
         |        24 bits          | 8 bits   |
         |        3 octets         | 1 octet  |

Subnetting and CIDR

What is Subnetting?

Subnetting divides a large network into smaller sub-networks (subnets).

Why subnet?

  • Reduce network congestion (broadcast domains)
  • Improve security (isolate departments)
  • Better IP address utilization
  • Easier troubleshooting

Subnet Mask

A subnet mask determines which part of an IP address is the network portion and which is the host portion.

IP Address:     192.168.1.100
Subnet Mask:    255.255.255.0  (same as /24)

Network part:   192.168.1.x    (first 3 octets)
Host part:      x.x.x.100      (last octet)

AND operation to find network address:

IP:    11000000.10101000.00000001.01100100  (192.168.1.100)
Mask:  11111111.11111111.11111111.00000000  (255.255.255.0)
AND:   11000000.10101000.00000001.00000000  (192.168.1.0)  ← Network Address

CIDR — Classless Inter-Domain Routing

CIDR notation uses prefix length instead of class-based addressing.

192.168.1.0/24   → means 24 bits are network bits
                 → same as 255.255.255.0
                 → 2^8 = 256 addresses; 254 usable hosts

10.0.0.0/8       → 8 network bits
                 → 2^24 = 16,777,216 addresses

Common CIDR blocks:

CIDRSubnet MaskHosts
/8255.0.0.016,777,214
/16255.255.0.065,534
/24255.255.255.0254
/25255.255.255.128126
/26255.255.255.19262
/27255.255.255.22430
/28255.255.255.24014
/30255.255.255.2522

Special addresses in a subnet:

  • Network address — first address (all host bits = 0) — not assignable
  • Broadcast address — last address (all host bits = 1) — sends to all hosts
  • Usable hosts = 2^(host bits) - 2

Continue learning

Related notes

Put this topic into timed practice

Open mock tests when you want full-exam pacing, or keep drilling in practice mode.