Mastering IP Subnetting and Network Address Calculation

Classified in Language

Written on in English with a size of 9.46 KB

Understanding IP Address Classes and Basic Subnetting

IP addresses are categorized into classes, each with a default subnet mask that defines its network and host portions. Let's examine examples for Class A, B, and C networks.

Class A IP Address Calculations

  • IP Address: 18.120.16.250
  • Default Class: Class A
  • Default Subnet Mask: 255.0.0.0 (or /8)
  • Network Address: 18.0.0.0
  • Broadcast Address: 18.255.255.255

Class B IP Address Calculations

  • IP Address: 18.120.16.255
  • Default Class: Class B
  • Default Subnet Mask: 255.255.0.0 (or /16)
  • Network Address: 18.120.0.0
  • Broadcast Address: 18.120.255.255

Class C IP Address Calculations

  • IP Address: 194.209.14.33
  • Default Class: Class C
  • Default Subnet Mask: 255.255.255.0 (or /24)
  • Network Address: 194.209.14.0
  • Broadcast Address: 194.209.14.255

Another Class C example:

  • IP Address: 190.33.109.133
  • Default Class: Class C
  • Default Subnet Mask: 255.255.255.0 (or /24)
  • Network Address: 190.33.109.0
  • Broadcast Address: 190.33.109.255

Summary of Default Classful Prefixes:

  • Class A: /8
  • Class B: /16
  • Class C: /24

Special IP Addresses and Their Meanings

Certain IP addresses hold special significance in networking:

  • 0.0.0.0: Represents the default route or "this host on this network."
  • 0.0.0.29: An example of a specific host IP.
  • 192.168.5.29: An example of a private IP address.
  • 192.168.67.0: An example of a private network address.
  • 255.255.255.255: The limited broadcast address, used to broadcast to all devices on the local network.
  • 192.168.5.0: An example of a private network address.
  • 192.130.10.255: A directed broadcast address for the 192.130.10.0 network.
  • 127.0.0.1: The loopback address, used to refer to the local machine itself.

CIDR Subnetting Examples

Classless Inter-Domain Routing (CIDR) allows for more flexible subnetting beyond the traditional class boundaries. Here are examples of calculating network and broadcast addresses using CIDR notation:

Example 1: /25 Subnet

  • IP Address: 190.33.109.133
  • Subnet Mask: 255.255.255.128 (or /25)
  • Network Address: 190.33.109.128
  • Broadcast Address: 190.33.109.255

Example 2: /28 Subnet

  • IP Address: 192.168.20.25
  • Subnet Mask: 255.255.255.240 (or /28)
  • Network Address: 192.168.20.16
  • Broadcast Address: 192.168.20.31

Example 3: /27 Subnet

  • IP Address: 192.168.20.25
  • Subnet Mask: 255.255.255.224 (or /27)
  • Network Address: 192.168.20.0
  • Broadcast Address: 192.168.20.31

Example 4: /26 Subnet

  • IP Address: 192.168.20.25
  • Subnet Mask: 255.255.255.192 (or /26)
  • Network Address: 192.168.20.0
  • Broadcast Address: 192.168.20.63

Example 5: /18 Subnet

  • IP Address: 140.190.20.10
  • Subnet Mask: 255.255.192.0 (or /18)
  • Network Address: 140.190.0.0
  • Broadcast Address: 140.190.63.255

Example 6: Another /18 Subnet

  • IP Address: 140.190.130.10
  • Subnet Mask: 255.255.192.0 (or /18)
  • Network Address: 140.190.128.0
  • Broadcast Address: 140.190.191.255

Example 7: Final /18 Subnet

  • IP Address: 140.190.220.10
  • Subnet Mask: 255.255.192.0 (or /18)
  • Network Address: 140.190.192.0
  • Broadcast Address: 140.190.255.255

Powers of Two for Subnetting

Understanding powers of two is crucial for subnetting, as it determines the number of hosts and subnets available:

  • 2^0 = 1
  • 2^1 = 2
  • 2^2 = 4
  • 2^3 = 8
  • 2^4 = 16
  • 2^5 = 32
  • 2^6 = 64
  • 2^7 = 128
  • 2^8 = 256
  • 2^9 = 512
  • 2^10 = 1024
  • 2^11 = 2048

Determining Network Details from an IP Range

Given a range of IP addresses, we can determine the network address, broadcast address, and subnet mask.

  • First IP in Range: 194.143.17.145
  • Last IP in Range: 194.143.17.158
  • Calculated Network Address: 194.143.17.144
  • Calculated Broadcast Address: 194.143.17.159
  • Subnet Mask: 255.255.255.240 (or /27)

VLSM Subnetting Problem: Allocating IP Ranges

Consider a Class B network 189.0.0.0/16 that needs to be subnetted to accommodate different numbers of PCs using Variable Length Subnet Masking (VLSM). The goal is to allocate contiguous blocks efficiently.

First, determine the required host bits and corresponding prefixes for each group of PCs:

  • To address 98 PCs: Requires 7 host bits (2^7 = 128 addresses). This results in a /25 prefix (32 - 7 = 25).
  • To address 400 PCs: Requires 9 host bits (2^9 = 512 addresses). This results in a /23 prefix (32 - 9 = 23).
  • To address 3200 PCs: Requires 12 host bits (2^12 = 4096 addresses). This results in a /20 prefix (32 - 12 = 20).
  • To address 5500 PCs: Requires 13 host bits (2^13 = 8192 addresses). This results in a /19 prefix (32 - 13 = 19).

Now, let's allocate the subnets sequentially from the base network 189.0.0.0/16:

Subnet 1: For 98 PCs

  • Required Prefix: /25
  • Network Address: 189.0.0.0
  • Subnet Mask: 255.255.255.128
  • Broadcast Address: 189.0.0.127
  • Usable Host Range: 189.0.0.1 to 189.0.0.126

Subnet 2: For 400 PCs

  • Required Prefix: /23
  • Network Address: 189.0.0.128
  • Subnet Mask: 255.255.254.0
  • Broadcast Address: 189.0.1.255
  • Usable Host Range: 189.0.0.129 to 189.0.1.254

Subnet 3: For 3200 PCs

  • Required Prefix: /20
  • Network Address: 189.0.2.0
  • Subnet Mask: 255.255.240.0
  • Broadcast Address: 189.0.17.255
  • Usable Host Range: 189.0.2.1 to 189.0.17.254

Subnet 4: For 5500 PCs

  • Required Prefix: /19
  • Network Address: 189.0.18.0
  • Subnet Mask: 255.255.224.0
  • Broadcast Address: 189.0.49.255
  • Usable Host Range: 189.0.18.1 to 189.0.49.254

This demonstrates how CIDR allows Internet Service Providers (ISPs) to efficiently allocate IP addresses, replacing traditional classful network boundaries with more flexible classless addressing. For example, an ISP might use 189.0.39.253 as a host IP within such a classless network allocation.

Related entries: