I am currently revising Networking for the Cisco CCNA1. One of the questions that I am struggling to answer is the following:

Which of the following IPv4 addresses are vaild subnet addresses:

  • 172.16.4.127 /26
  • 172.16.4.155 /26
  • 172.16.4.193 /26
  • 172.16.4.95 /27
  • 172.16.4.159 /27
  • 127.16.4.207 /27

I can't get my head around how to know understand when a subnet address is valid or not.

Many thanks

link|improve this question
3  
possible duplicate of How does Subnetting Work? – John Gardeniers Jun 1 '11 at 21:56
feedback

migrated from stackoverflow.com Jun 1 '11 at 19:26

This question came from our site for professional and enthusiast programmers.

3 Answers

IP addresses are 32-bits long, the mask is also 32 bits. When you perform a logical AND of the address and the mask, you get the subnet address. See this wikipedia section on how to determine the network prefix.

My mental shortcut that works for netmasks >= 25 is I subtract the mask length from 32 and look at the last octet of the IP address... that is the maximum host bits in the address (call that number h). If the last octet is evenly divisible by 2**h, then that is a subnet address.

For example, 172.16.4.127/26... 32 - 26 = 6. 2**6 = 64 and 127 % 64 = 63. Therefore, 172.16.4.127 is not a valid subnet address... in fact it is the broadcast address for the 172.16.4.64/26 subnet. Good luck with your CCNA exam.

link|improve this answer
1  
Thank you very much Mike! This is a great help to me. – Phil Apr 19 '11 at 16:45
feedback

The answer is either all, or none depending on what they mean.

The normal understanding of a 'valid' subnet address is one in which the address quoted is the lowest possible in the specified range. Hence a /26 (64 addresses) would end with a multiple of 64, and a /27 would end with a multiple of 32.

None of the addresses you've quoted meet that rule.

  • 172.16.4.127 /26 - this is the broadcast address for 172.16.4.64 /26
  • 172.16.4.155 /26 - this sits in the range 172.16.4.128 - 191
  • 172.16.4.193 /26 - this is the first usable address in 172.16.4.192 /26
  • 172.16.4.95 /27 - this is the broadcast address for 172.16.4.64 /27
  • 172.16.4.159 /27 - this is the broadcast address for 172.16.4.128 /27
  • 127.16.4.207 /27 - this sits in the range 172.16.4.192 - 223

Are you sure you copied them correctly?

link|improve this answer
I'm not quite sure I'm parsing your answer... you say it could be all or none depending on what they mean... 172.16.4.127/26 is not a valid subnet address... That is the broadcast address, by definition. He is studying for a test, and they throw these kind of problems at them to ensure they understand the concepts correctly. – Mike Pennington Apr 19 '11 at 9:57
what I'm saying is that none of the supplied values match the usual definition of a "subnet address". – Alnitak Apr 19 '11 at 10:13
@ Mike Pennington - "to ensure they understand" I find CCNA very difficult, I can pass 90% of the exams, and I can subnet successfull, but I dont understand theses sorts of questions. So for instance 172.16.4.127/26 is the last address before the next subnet meaning that it is a broadcast address, this means that it is not a useable address by a host therefore not a subnet address.Is this correct? – Phil Apr 19 '11 at 16:43
feedback
  • A is the broadcast address for the subnet "10"
  • B is a valid address for the subnet "10" which is a valid subnet.
  • C is a valid address for the subnet "11" which is considered to be an invalid subnet
  • D is the broadcast address for the subnet "101"
  • E is a valid address for the subnet "110" whcih is a valid subnet.

I see this way: B and E are valid IP address and I think it's what they mean as "IPv4 addresses are vaild subnet addresses" although the question in the way it's put is likelly to cause misunderstanding.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown