0

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
255.255.192.0 - Subnet Mask
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?

에이바
  • 612
  • 4
  • 11
  • 34
  • 3
    Did you read this post: http://serverfault.com/questions/49765/how-does-subnetting-work? – Coops Mar 02 '11 at 22:53
  • Great post Covers the bases – Dave M Mar 02 '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 - Reinstate Monica Mar 02 '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 02 '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 03 '11 at 02:39

1 Answers1

2

First, read the linked post.

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
Address:   138.248.184.17       10001010.11111000.10 111000.00010001
Netmask:   255.255.192.0 = 18   11111111.11111111.11 000000.00000000
Wildcard:  0.0.63.255           00000000.00000000.00 111111.11111111
=>
Network:   138.248.128.0/18     10001010.11111000.10 000000.00000000
HostMin:   138.248.128.1        10001010.11111000.10 000000.00000001
HostMax:   138.248.191.254      10001010.11111000.10 111111.11111110
Broadcast: 138.248.191.255      10001010.11111000.10 111111.11111111
Hosts/Net: 16382                 Class B
Cakemox
  • 24,141
  • 6
  • 41
  • 67