How to Calculate Available IPs in IPv4 Subnetting: A /29 Network Example


3 views

IPv4 subnetting divides a network into smaller subnetworks using a subnet mask. The /29 notation is CIDR (Classless Inter-Domain Routing) format, indicating how many bits are allocated for the network portion of the address.

For a /29 subnet:

Total bits in IPv4 address: 32
Network bits: 29
Host bits: 32 - 29 = 3
Possible hosts: 2³ = 8
Usable hosts: 8 - 2 (network + broadcast) = 6

Let's break down this specific subnet:

Network address: 196.44.198.32
First usable IP: 196.44.198.33
Last usable IP: 196.44.198.38
Broadcast address: 196.44.198.39

Here's a Python function to calculate subnet details:

import ipaddress

def subnet_info(cidr):
    net = ipaddress.IPv4Network(cidr)
    return {
        'network': str(net.network_address),
        'netmask': str(net.netmask),
        'broadcast': str(net.broadcast_address),
        'first_host': str(list(net.hosts())[0]),
        'last_host': str(list(net.hosts())[-1]),
        'usable_hosts': len(list(net.hosts()))
    }

print(subnet_info("196.44.198.32/29"))

This small subnet is typically used for:

  • Point-to-point connections
  • Network device management interfaces
  • Small business networks with few devices

Quick reference for common subnet masks:

/30 = 4 total, 2 usable (common for P2P links)
/29 = 8 total, 6 usable
/28 = 16 total, 14 usable
/24 = 256 total, 254 usable (classic Class C)

html

The "/29" in 196.44.198.32/29 represents CIDR (Classless Inter-Domain Routing) notation, where 29 indicates the number of network bits in the subnet mask. This leaves (32-29)=3 bits for host addressing.

Let's convert this to binary for clarity:

Network:   196.  44. 198.  32  → 11000100.00101100.11000110.00100000
Subnet Mask: /29 → 255.255.255.248 → 11111111.11111111.11111111.11111000

With 3 host bits (2³=8), we subtract 2 (network and broadcast addresses):

Total IPs: 8
Usable Hosts: 8 - 2 = 6
Network Address: 196.44.198.32
First Host:      196.44.198.33
Last Host:       196.44.198.38
Broadcast:       196.44.198.39

Here's a Python function to calculate subnet details:

import ipaddress

def subnet_calculator(ip_cidr):
    network = ipaddress.IPv4Network(ip_cidr, strict=False)
    print(f"Network Address: {network.network_address}")
    print(f"Broadcast Address: {network.broadcast_address}")
    print(f"Usable IP Range: {network.network_address + 1} - {network.broadcast_address - 1}")
    print(f"Total Hosts: {network.num_addresses}")
    print(f"Usable Hosts: {network.num_addresses - 2}")

# Example usage:
subnet_calculator("196.44.198.32/29")

When configuring network devices, you might see:

interface GigabitEthernet0/1
 ip address 196.44.198.33 255.255.255.248
 no shutdown
  • Point-to-point links between routers
  • Small business networks with few devices
  • DMZ segments for public-facing servers

Variable Length Subnet Masking allows efficient allocation:

196.44.198.32/29 → 6 hosts (WAN link)
196.44.198.40/28 → 14 hosts (LAN segment)
196.44.198.56/30 → 2 hosts (router interconnect)