# Determining Host portion from a given ip address

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
``````

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)

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).

• so in this case, I could say the host id in the address would be 00000001.11011011 or in decimal format 1.217? 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? Oct 3, 2014 at 1:45
• 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. 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? Oct 3, 2014 at 10:31
• BTW, the first octet of your address is shifted 1 bit to the right. It should be 10101111. Oct 3, 2014 at 12:25

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

• so a class A address mean by default 255.0.0.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.