# Trouble subnetting [duplicate]

Possible Duplicate:
How does Subnetting Work?

I have to learn how to subnet by hand for the CCNA exam. And I'm having real problems doing it. I keep getting stuck.

Here's an example:

138.248.184.17/18 - IP
192 = 1100 0000 in binary
And I know 184 in the IP address is the "octet of interest".
OK I get that far...and then I'm lost.

I know I need to set the network bits of 192(I think?) to all 0 for the network ID and then to all 1 for the broadcast ID. Problem is how do I know which part of 11000000 is network and which part is host?

-

## marked as duplicate by EEAA♦, RobM, Ward, John Gardeniers, SamMar 3 '11 at 21:00

Did you read this post: serverfault.com/questions/49765/how-does-subnetting-work? – Coops Mar 2 '11 at 22:53
Great post Covers the bases – Dave M Mar 2 '11 at 22:57
@Coops: put your answer back as an answer, but I'd make it just a simple statement: "Read this post." – Ward Mar 2 '11 at 22:57
Yes, but there is an even more simple way of doing what that post explains and that's what I'm trying to get the answer to (basically without converting the entire IP to binary). – 에이바 Mar 2 '11 at 22:58
If there was a simple and reliable way to do it without going to binary don't you think we would all be doing it? Stop trying to find shortcuts and concentrate on learning to do it properly. Then you only have to learn it once. – John Gardeniers Mar 3 '11 at 2:39

Don't worry. I understand the value of preparing your RFC 1149 network after the shipwreck.

You don't need to convert the whole IP to binary. The first two octets you already know because the mask is all ones (255 = 11111111), so 138.248.something.

The third octet you do need to convert to binary up until the end of the ones since you are doing a bitwise AND. Convert the netmask's octet to binary: 192 = 11000000. Here you only need to examine the first two bits of the third octet since the rest you know is zero. 184 is less than 192, so it must start with 10 since if it started with 11 it would have to be 192 or greater. Thus, the third octet of the network is 128.

The fourth is 0 since the fourth octet of the netmask is 0.

138.248.128.0

`ipcalc` can help you check your math.

``````\$ ipcalc 138.248.184.17/18