Finding the network and host address, and maximum number of host addresses

ipv4

A subnet of an IP network has a range of IP host address from
172.19.40.1 to 172.19.47.254.

  • What is the maximum number of host addresses that can exist on this subnetwork?
    I'm googling but not found a clear answer. how should we compute maximum number of host addresses?

Best Answer

A subnet of an IP network has a range of IP host address from 172.19.40.1 to 172.19.47.254.

What is the maximum number of host addresses that can exist on this subnetwork? I'm googling but not found a clear answer. how should we compute maximum number of host addresses?

Method 1

Let's use a simple method to find this...

IP addresses contain four 8-bit integers; 8-bit integers have a maximum value of 255. Think of it like this... if we merely build a sequence of third-octets from 40 to 47 and account for the hosts, we'll find the answer with minimal math...

  • 172.19.40.1 through 172.19.40.255 = 255 hosts
  • 172.19.41.0 through 172.19.41.255 = 256 hosts
  • 172.19.42.0 through 172.19.42.255 = 256 hosts
  • 172.19.43.0 through 172.19.43.255 = 256 hosts
  • 172.19.44.0 through 172.19.44.255 = 256 hosts
  • 172.19.45.0 through 172.19.45.255 = 256 hosts
  • 172.19.46.0 through 172.19.46.255 = 256 hosts
  • 172.19.47.0 through 172.19.47.254 = 255 hosts

Number of hosts = 2*255 + 6*256 = 2046 hosts

Method 2

Use this method to find the number of hosts between two arbitrary IP addresses... convert the two 32-bit IP addresses to integers and subtract...

  • 172.19.40.1 => 2886936577
  • 172.19.47.254 => 2886938622

2886938622 - 2886936577 + 1 = 2046 hosts

Note that I added an extra host in the subtraction, since you're including the first host in the list of available hosts.

As someone mentioned below you can also use the host bits of the netmask, if you're merely calculating the number of hosts in an IP CIDR block.

How to convert an IPv4 addess to decimal:

172*256**3 + 19*256**2 + 40*256**1 + 1*256**0 = 2886936577

Related Topic