2

Given /26 subnets for a /24 network:

Subnet 1 0-63 
Subnet 2 64-127
Subnet 3 128-191
Subnet 4 192-255

Does every subnet have its own network ID and broadcast address?

Meaning:

Subnet 1 0-63 (network is 0, broadcast is 63)
Subnet 2 64-127 (network is 64, broadcast is 127)
Subnet 3 128-191 (network is 128, broadcast is 191)
Subnet 4 192-255 (network is 192, broadcast is 255)

Therefore, -2 for every subnet as they cant be assign to a host. Am i right?

Ron Maupin
  • 99,565
  • 26
  • 120
  • 195
user2947950
  • 83
  • 1
  • 3
  • 6
  • 1
    This question and the excellent answer will explain how to do IPv4 correctly. If you do this in binary (the correct way to do it), it becomes obvious. IPv4 addresses are really 32-bit binary numbers, but we use the dotted-decimal notation to make it easier for humans to read. However, trying to actually do IPv4 math on the dotted-decimal notation will lead to errors. – Ron Maupin Apr 15 '17 at 15:00

4 Answers4

6

Therefore, -2 for every subnet as they cant be assign to a host. Am i right?

There are two exceptions to that rule: /31 and /32 networks.

  • /31 networks are used for point-to-point links. This was standardized in December 2000, when RFC 3021, Using 31-Bit Prefixes on IPv4 Point-to-Point Links was published. The key is that there is no need for broadcast on a point-to-point link because every other host on a point-to-point network will get the traffic, anyway. Ordinarily, using /30 for point-to-point networks wastes half of the network addresses. This can really add up when your business has a lot of point-to-point links. You can cut the number of used addresses in half, doubling the number of point-to-point links with the same number of addresses.
  • /32 networks are commonly used for things like router loopbacks. These networks must be routed to send or receive traffic to/from any other host because there is only one possible host on the network.
Ron Maupin
  • 99,565
  • 26
  • 120
  • 195
2

Yes, you are right. Although no one does this in the practical day to day world, it is easier to see this if you convert the subnet in question into binary digits and then remember that the broadcast address is simply the case with all 1s and the network address with all zeroes.

AlwaysLearning
  • 401
  • 3
  • 5
1

Yes you are correct.

I will explain here how we got that.

For a given number of binary digits (say x), 2^x gives the number of different binary numbers that can be made from it.

So when we consider the number of '0' bits in the subnet mask, we can find out the number of different binary numbers that can be made from it using the above formula. However, in a subnetwork two numbers out of these possible different binary numbers is reserved to make the Network address and the Broadcast address. These are formed by combining the network portion of the IP address with the 1st possible combination and the last possible combination of the number of bits under the host portion of the IP address receptively.

Let me explain this through an example. Consider 192.168.209.176/28

11000000 10101000 11010001 10110000 - IP address
11111111 11111111 11111111 11110000 - Subnet mask

There are 4 '0' bits in the subnet mask. 2^4=16. The combinations are 0000, 0001, 0010, ... , 1101, 1110, 1111.

Combining the network portion of the IP address (11000000 10101000 11010001 1011) with the 1st combination (0000) gives us 11000000 10101000 11010001 10110000 which when converted to decimal is 192.168.209.176. This is the Host address for this subnet.

Combining the network portion of the IP address (11000000 10101000 11010001 1011) with the last combination (1111) gives us 11000000 10101000 11010001 10111111 which when converted to decimal is 192.168.209.191. This is the broadcast address for this subnet.

As you have stated in your question, we have to substract 2 addresses, the Network address and the broadcast addresses because we cannot assign them to hosts. Therefore we can modify the above equation to obtain the number of hosts in a subnetwork as (2^x)-2 where x is the number of host bits in the subnet mask


Now consider 192.168.209.176/31.

Since there is only 1 host bit in the subnet mask, 2 addresses can be formed. But since we must reserve 2 addresses for the network address and broadcast address, we are not left with any addresses to be assigned to hosts. (2^2)-2=0.

Therefore a subnetwork with /31 useless.

Ron Maupin
  • 99,565
  • 26
  • 120
  • 195
-1

Regarding the /32 and /31 questions...

/32 is a subnet in the sense that it's 'a part of a larger network.' /31 is also. But /32 is typically used to reference a single host. Typically /31 just isn't used. Even for an access list, people commonly would put two /32's or preface the IP with host...twice. That being said, I'm pretty sure you're never going to see a l3 link configured with a /32 or a /31 ever. But you may see individual hosts or ACL's with /32's.

Dave
  • 1