why AND-ing?

Jun 05, 2006 9 Replies

I find AND-ing a confusing concept in subnetting and I was wondering if it's necessary or not. To find the subnet where a host address lives on, we simply turn off all host bits and find the subnets as multiple of last subnet bit. The subnet where our host lives on is the subnet where the host range includes our host, right?



Example: Host address 10.17.2.14/18 Class A, so turning off all hosts bits will give us the subnets as multiple of 64. That is, 10.17.0.0; 10.17.64.0 etc. Since in 10.17.2.14 number 2 is in the range of the subnet 0 (0 to 64) then the answer is: Our host lives on subnet 0: 10.17.0.0



new guy :)


I'd like to see what other people have to say about this - I can't fault your logic. Doing a bitwise AND on the host address and subnet mask would yield the same answer.

Only thing that I'd say is that for the purposes of the CCNA exam, you must assume that you can't use subnet zero, is that still correct?

Cheers,

Chris.

Thanks for the answer! I would also like to have more examples and find the answers in a logic, simple way, without having to write anything down. Just by looking at the address you know how many bits have been borrowed, and that's all you need to automatically find the subnet (as a multiple of the last bit borrowed) with the hosts range where the given host lives on.

This is beside the point, however: The first subnet (subnet 0) has the same address as the network and it's considered "unusable subnet". The last subnet is also considered "unusable subnet" because contains the network broadcast address. Therefore, if there is an exam question on calculating the number of subnets, the formula 2^n - 2 is used, where n is the number of borrowed bits from the host portion inorder to subnet the network. I have not taken the exam yet though :)

new guy :)

i use 256 - subnet mask = first subnet address

ex:

/18 = 255.255.192.0

256-192=64

first non zero subnet for 10.17.0.0/18 is 10.17.64.0 host addreses(64.1 ->

64.126) 2nd subnet is 10.17.128.0/18 host addresses (128.1 ->128.190)

On Mon, 5 Jun 2006, it was written:

Yes, that is basically what AND-ing is, i.e x AND 1 = x, x AND 0 = 0.

So, in your example, you have:

10.17.2.14/18 (10.17.2.14 netmask 255.255.192.0) or 00001010.00010001.00000010.00001110 AND 11111111.11111111.11000000.00000000

-----------------------------------

00001010.00010001.00000000.00000000 = 10.17.0.0

Doan

This is why I like Usenet so much. Lots of people explaining things in different ways. Sometimes just the way an explanation is phrased can help you understand something a little better.

I already knew the above, but something about the way you explained it helped it to fit in my head a little better :) Thanks for that!

You are welcome! It's not easy to find good explainations about subnetting :)

new guy :)

a use of AND is for comps (not necessarily humans) to retain some bits and set others to zero. comps don't need to look at multiples as you are. Comps figure out what subnet a host is on by looking at the subnet bits.

i'm quite sure they then use "Not XOR " (XNOR) to test if 2 bit patterns are the same.

This is great.

I have just started my CCNA studies and finally got the concept of Subnetting last night. I like re-reading stuff like this in order to see how other people see it in order to expose myself to different ways of coming to the same solution.

Regards,

MrBigglesworth

q_q snipped-for-privacy@yahoo.co.uk wrote:

glad to hear it, good luck

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required