3

I need to determine the subnetmask and Host Id of a given address: 175.142.213.217/22

This is what I have so far:

Address:    01010111.10001110.11010101.11011001
SubnetMask: 11111111.11111111.11111100.00000000 = 255.255.252.0

The part I'm stuck on is how to determine the Host Id.

Can someone please explain to me in great detail how I would get to that point from what I have so far (assuming my answers above are correct)

3 Answers 3

3

You have a subnet mask, but you need a host mask, which is just the NOT of the subnet mask (reverse the ones and zeros) to get 00000000.00000000.00000011.11111111.

AND the address and the host mask (only ones in both positions get to be one in the result) to get 00000000.00000000.00000001.11011001.

Convert that back to decimal (0.0.1.217) or give it as an offset into the subnet (473).

5
  • so in this case, I could say the host id in the address would be 00000001.11011011 or in decimal format 1.217? Commented Oct 3, 2014 at 1:37
  • and if my ip address changed to 175.142.215.217/22 (01010111.10001110.11010111.11011001) it would be 00000011.11011011 or 3.217, or am I not getting it? Commented Oct 3, 2014 at 1:45
  • 2
    That is the host portion of the address. I'm not completely sure that I understand what you mean by host ID. The entire IP address is really the host ID. The subnet mask will determine the network portion of the address, and the host portion can be determined by my method above.
    – Ron Maupin
    Commented Oct 3, 2014 at 2:05
  • apoligies if I'm using the wrong terminolgy; I just started a networking class (which I have little to no prior experience in). So in my seccond example, 175.142.215.217/22 would actchualy be the host ID, with 3.217 being the host portion? Commented Oct 3, 2014 at 10:31
  • BTW, the first octet of your address is shifted 1 bit to the right. It should be 10101111.
    – Ron Trunk
    Commented Oct 3, 2014 at 12:25
2

I think you mean host ip, but... whatever

there are 5 classfull address, A B C D E. The difference from each other is the first bits in the first octet:

  • A first bit=0 so from 1 to 127 in decimal
  • B first two bits=10 so from 128 to 191 in decimal
  • C first tree bits=110 so from 192 to 223 in decimal
  • D first four bits=1110 so from 224 to 239 in decimal
  • E first five bits=1111 so from 240 to 255 in decimal

In the past those class was used instead of subnet mask,

  • so a class A address mean by default 255.0.0.0 as subnet mask
  • Class B address mean by default 255.255.0.0 as subnet mask
  • Class C address mean by default 255.255.255.0 as subnet mask.
  • Class D and E are used for particular purpose

so, in a class A the host-id is represented by the last 3 byte (the last 24 bits)

in a class B the host-id is represented by the last 2 byte (the last 16 bits)

in a class C the host-id is represented by the last 1 byte (the last 8 bits)


so, to calculate the host id in a classfull notation is pretty simple.

but if you want to calculate it in a classless notation... is quite simple, too:

you just have to take the portion of the host address in binary (just count the number of zeros in the subnet mask: that is the number of bit dedicated to the host), then translate it in decimal. Be carefull:

you have to translate in decimal maximum 8 bits each time, from right to left. If the host id is more than 8 bits, you have to translate in decimal the first part, write a dot on the left, then the other bits, maximum 8 bits each time. That's why an ip address like that (256.256.256.256) doesn't exist.

1

Address: 01010111.10001110.11010101.11011001

SubnetMask: 11111111.11111111.11111100.00000000 = 255.255.252.0

Just to clarify, your Host ID is your actual IP address above. But here is how it looks from the binary perspective.

The subnet is determined from the natural "class B" network, which is everything from the left of the 16th binary bit, so we are dealing with the last 2 octets here. Your subnet is dictated by the "1" bits from left to right, starting from the 16th bit. So you have 6 bits set for the subnet (252 or /22) This leads us to the host bits. In this case the host bits are the "0"'s starting from right to left, from the very last bit. In this case we have 10 "0" bits set for your Host ID's to come from.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.