As I mentioned in Part 2, you start of with one small table and as you go deeper and deeper you end up with

about 6 tables and 4 pages of IP addresses that you have to remember. The other way is to understand how IP

addresses work from the ground-up and you won't have to remember 4 pages of tables. I'll do my best to explain

how IP addresses work from the ground- up in the following sections.

First, we'll construct all the tables in Part I and Part II. This is really hardcore stuff if you haven't been through it

before. First we'll construct this table:

Network Class First Octet Value Default SUBNET MASK # of Networks # of Hosts per network Class A 1 - 126

255.0.0.0 1) 126 1A) 16, 777, 214 Class B 128 - 191 255.255.0.0 2) 16, 384 2A) 65, 534 Class C 192 - 223 255.255.255.0

3) 2, 097, 152 3A ) 254

The numbers and letters in red are used to illustrate the process.

In order to construct the table from scratch you have to remember the valid range of the first octet in each

network class. You'll also have to remember the default subnet masks. Those are the only 2 things that you have

to remember. You have to remember them because they were arbitrary assigned when IP addresses were created.

This is really conceptual stuff, so I'll do the best I can in the following section. If you still can't grasp the concept,

please do not email me with questions. Email Ron "The NTFS Animal" with your questions. :-)

To get 1). Your class A address follows this pattern 1-126. x. y. z. The first octet can be any value from 1 to 126,

which means you can only have a total of 126 networks in the entire Internet. This one is easy.

To get 1A ). The number of hosts per network in class A. Remember permutations and combinations in high

school? ( I do, because I've only been out of it for 5 years. ) In a class A address, the 2nd, 3rd and 4th octets can

be any value from 0-255. But remember that there are 256 numbers between 0 and 255. What you do is you take all

the possible values in the 2nd octet and multiply it by all the possible values in the 3rd and 4th octets. So 256 *

256 * 256 = 16, 777, 216. But if you look at the table again, the answer is 16, 777, 214. What you have to do is

subtract 2 from 16, 777, 216 and you get 1A). You subtract 2 from the answer because your hosts cannot have 0

or 255 in their IP addresses. Remember that they are used for broadcasting purposes.

To get 2). The number of networks in class B. Your class B address follows this pattern 128-191.255.x.y. The value

of the first octet can be from 128-191, but remember there are 64 numbers between 128 and 191. For example, how

many numbers are there between 2 and 8? The answer is 7 and not 6. Try it for yourself. Anytime you have a

range of numbers, x - y, to find out how many numbers there are between them use: ( y - x ) + 1. For your class B

address the second octet can be from 0-255. Also, this will be the last time that I will mention this: there are 256

numbers between 0 and 255. So to get 2) you do this: 64 * 256 = 16, 384. Multiply all the possible values in the 1st

octet by all the possible values in the second octet.

To get 2A). The number of hosts in class B. Again, your class B address follows this pattern 128-191.255.x.y. The

x and the y can be any value from 0 - 255. So 256 * 256 = 655, 536. You have to subtract 2 from the answer because

0 and 255 are used for broadcasting. If you subtract 2, you get the same answer as 2A). Again, this has to do with

combinations. Take all the possible values you can have in the 3rd octet and multiply it by all the possible values

in the 4th octet.

To get 3). The number of networks in class C. Remember that the first 3 octets in a class C address identifies the

network ID ( address ). However, the first octet in a class C can only be from 192 - 223. All the possible values in

the first octet of a class A address are: ( 223 - 192 )+ 1 = 32. Now multiply all the possible values in the 1st, 2nd

and 3rd octets ( 32 * 256 * 256 = 2, 097, 152 ), which is exactly the same as 3).

To get 3A). The number of hosts in class C. In a class C address ONLY the 4th octet identify your hosts. The

values in the 4th octet can be from 0 - 255. There can be 256 possible values but you have to subtract 2 from the

answer; and you get 254.

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

Let's say that you've typed in www.hardcoremcse.com to get to this site. When you do this you are using a

domain name, which is used to mask the IP address so you can remember the URL better. Beneath every domain

name is an IP address. Also, beneath every IP address is a BINARY representation of the IP address itself. This

binary code is used by the computer and the binary code is the only code that the computer understands. For

example, if they mean the same thing, which is easier for you to remember?

A) www.hardcoremcse.com B) 207.112.26.91 C) 1100 1111.0111 0000.0001 1010.0101 1011

Of course the answer is A, unless you're the Rain Man. Anytime you want to go to any website you can type in

its domain name or you can type in its IP address at the URL locator of your browser. However, you should note

that typing in the IP address will not always work because of the use of DHCP ( Dynamic Host Configuration

Protocol ) servers. I won't go into any details about DHCP servers here. Just remember that there is an IP address

beneath every domain name. In the question above, it doesn't matter to a computer what the answer is. It can

remember all three just the same.

Remember that a computer is just a bunch of electronic switches, either the switch is on or off. The number 1

denotes an ON switch and a 0 denotes an OFF switch. Also remember that you can also represent computer

language by using the base 2 number system raised to the power n. Okay, enough. Let's get hardcore about the

subnetting table.

Question 1. Without using a calculator convert 1111 1110 to its decimal value.

These type of questions are really easy. Here is all you have to do:

128 64 32 16 8 4 2 1 1 1 1 1 1 1 1 0

Wherever you see the binary value of 1's, take the decimal value above them and add them all up. In this case: 128

+ 64 + 32 + 16 + 8 + 4 + 2 = 254. The decimal value of 1111 1110 is 254.

Question 2. Without using a calculator convert 1100 1011 to its decimal value.

Again, wherever you see a 1 in the binary value, use the decimal value above it and add all the values up.

128 64 32 16 8 4 2 1 1 1 0 0 1 0 1 1

In this case: 128 + 64 + 8 + 2 + 1 = 203. The decimal value of 1100 1011 is 203.

Question 3. Without using a calculator convert 1 1100 to its decimal value.

For this question, you have to be careful. There are 8 bits in an octet so what you have to do is add some leading

zeroes. So 1 1100 becomes 0001 1100. Then use the table:

128 64 32 16 8 4 2 1 0 0 0 1 1 1 0 0

16 + 8 + 4 = 28. The decimal value of 1 1110 is 28. Just remember to add leading zeroes to make the byte 8 bits

before you apply the conversion. I hope by now you can see the pattern of 128, 64, 32...You see, there is a direct

relationship between decimal numbers and the base 2 number system.

Now, we'll construct the subnet table. Just remember the letters and numbers in red are used to illustrate the

process.

Hosts Per Subnet Binary value of Subnet Mask Decimal Value of Subnet Mask # of Subnets 2n-2 Class A Class B

Class C 1111 1111 (n=8) 255 1) 254 1A) 65, 534 1B) 254 1C) 0 1111 1110 (n=7) 254 126 131, 070 510 0 1111 1100 (n=6)

252 62 262, 142 1, 022 2 1111 1000 (n=5) 248 30 524, 286 2, 046 6 1111 0000 (n=4) 240 14 1, 048, 574 4, 094 14 1110

0000 (n=3) 224 6) 6 6A) 2, 097, 150 6B) 8, 190 6C) 30 1100 0000 (n=2) 192 2 4, 194, 302 16, 382 62

To get 1). If you want to divide your network into 254 subnets, then you would use the decimal value of 255

somewhere in your subnet mask. We'll use class A in this example. If you want to divide your class A address

into 254 subnets, then you would use the subnet mask of 255.255.0.0. If you express 255.255.0.0 in binary, it would

look like this.

255. 1111 1111. 0000 000. 0000 0000.

I didn't convert the 255 because the first octet is fixed in a class A address so it won't figure into the calculation.

To get the number of subnets convert the subnet mask to its binary notation, then count up all the bits with 1's

and apply this formula: 2n - 2. Where n represents all the bits with the value of 1's. In this case there are 8 1's, so

28 - 2= 254. You have to subtract 2 from the equation because your subnet IP addresses cannot include 0 or 255

in them.

To get 1A). The number of hosts allowed per subnet if you have 254 subnets in your class A address. If you

have a class A address and you want to divide your network into 254 subnets then you would use the subnet

mask of 255.255.0.0. Remember in a class A address the first octet is fixed. Again, the binary equivalent of

255.254.0.0 is:

255. 1111 1111. 0000 000. 0000 0000.

To get the number of hosts per subnet, first convert the subnet into its binary equivalent, then apply this formula:

2z -2. Where z represents the number of bits set to zero in your octets. In this case there are 16 zeroes in the

subnet mask of 255.255.0.0. So applying the formula: 216 - 2 = 65, 534, which is exactly the same as 1A). Again,

you subtract 2 from the equation because the IP address of your hosts cannot include 0 or 255.

To get 1B). If you want to divide your class B network into 254 subnets, then you would use the subnet mask of

255.255.255.0. Remember that in a class B address the 1st and 2nd octets are fixed. The binary value of

255.255.255.0 is:

255.255. 1111 1111. 0000 0000

I didn't convert the 1st or 2nd octets into their binary equivalents because in a class B address the 1st and 2nd

octets are fixed, even for their subnet masks. To get the number of subnets use: 2n - 2. Where n is the number of

bits with the value of 1's, in this case there are 8 of them, so 28 - 2 = 254 subnets. To get the number of hosts use:

2z - 2, where z represents the the bits with 0's. In this case there are also 8 of them. So 28 - 2 = 254, which is the

same as 1B).

To get 1C). The number of hosts per subnet if your network is divided into 254 subnets. If you want your class C

network to have 254 subnets then your subnet mask would be 255.255.255.255, which would look something like:

255.255.255. 1111 1111.

I didn't convert the 1st, 2nd or 3rd octets because they are fixed in a class C network, even for their subnet masks.

To get the number of hosts, apply 2z - 2. Where z represents the bits set to 0's. In this case there are no bits set to

0, so the equation will not work. You would end up with -1 hosts per subnet. What this means is that if you divide

your class C network into 254 subnets, you can't have any hosts. In a production environment, if you have a

class C network, you would probably never divide your network into more than 6 subnets. Look at the table to

see how the number of hosts per subnet would be affected if you were to divide your Class C address into more

than 6 subnets.

By now you should see a general pattern developing. I'll do a few more examples.

To get 6). If you want to divide your network into 6 subnets you would use the decimal value of 224 somewhere

in your subnet mask. I'll use class A in this example again. If you want to divide your class A address into 6

subnets, you would use a subnet mask of 255.224.0.0. In binary form it would look like this:

255. 1110 0000. 0000 0000. 0000 0000

Again, I didn't convert the 1st octet because it is fixed in a class A address. To get the number of subnets use: 2n

- 2. Where n represents the number of bits set to 1, in this case there are 3 of them; so 23 - 2 = 6 subnets.

To get 6A). If you want to divide your class A address into 6 subnets how many hosts per subnet can you have?

First, if you want to have 6 subnets in your class A address you would use a subnet mask of 255.224.0.0, which in

binary form looks like:

255. 1110 0000. 0000 0000. 0000 0000

To get the number of hosts per subnet use 2z - 2. Where z represents the number of bits set to 0 in the octets. In

this case there are 21 of them. So 221 - 2 = 2, 097, 150, which is exactly the same as 6A).

To get 6B). If you want to divide your class B network into 6 subnets you would use a subnet mask of

255.255.224.0, which in binary looks like this:

255.255. 1110 0000. 0000 0000

Again, I didn't convert the 1st or 2nd octets because they are fixed in a class B address, even for the subnet mask.

To get the number of hosts per subnet use: 2z - 2. Where z represents the 0's in your octets. In this case there are

13 of them. So 213 - 2 = 8, 190 hosts per subnet, which is exactly the same as 6B).

To get 6C). If you want to divide your class C network into 6 subnets, then you would use the subnet mask of

255.255.255.224, which is:

255.255.255. 1110 0000

Again, I didn't convert the 1st, 2nd and 3rd octets because they are fixed and do not figure into the calculations.

To get the number of hosts per subnet use: 2z - 2. Where z is the number of 0's in your octets. In this case there

are 5 of them. Using the formula: 25 - 2 = 30 hosts per subnet, which is the same as 6C).

I am going to stop here. But by now you should be able to construct the IP address table and the subnet table by

just remembering these two things: The range of the first octets in each network class and their subnet masks.

Question 1. Your IP address is 140.100. x. y and your subnet mask is 255.255.255.224. How many subnets and

hosts can you have on your internetwork?

Answer: In this question, memorizing the subnet table will NOT help you. This is an example of one of the pitfalls

of trying to memorize the tables. Back to the question: First, you know that the network address belongs in class

B because the 1st octet ( 140 ) falls between 128 and 191. In a class B address the 1st and 2nd octets are fixed,

even for the subnet mask. Now convert the subnet mask into its binary equivalent:

255.255. 1111 1111. 1110 0000

To get the number of subnets use: 2n - 2. Where n represents the number of bits set to 1's in your octets. In this

case there are 11 of them. Apply the formula: 211 - 2 = 2, 046. This means that if you have a class B address with a

subnet mask of 255.255.255.224, you can have 2, 046 subnets on your internetwork.

To get the number of hosts per subnet use: 2z - 2. Where z represents the bits set to 0's in your octets. In this

case, there are 5 of them. Apply the formula: 25 - 2 = 30. This means that you can have 2, 046 subnets with 30

hosts per subnet if your network address is in class B with the subnet mask of 255.255.255.224. This is just an

example. In a production environment, if you work for a company that has a class B address and you divide your

network into 2, 046 subnets then there's a 80 % percent chance that your IT manager will fire you the next day.

Question 2: Your subnet mask is 255.255.255.248. How many subnets and hosts can you have on your

internetwork?

Answer: You cannot answer the question with the information given. There are 3 possible answers:

If the network address belongs to class A, then:

255. 1111 1111. 1111 1111. 1111 1000

Number of subnets: 221 - 2 = 2, 097, 150 Number of hosts per subnet: 23 - 2 = 6

If the network address belongs to class B, then:

255.255. 1111 1111. 1111 1000

Number of subnets: 213 - 2 = 8, 190 Number of hosts per subnet: 23 - 2 = 6.

If the network address belongs to class C, then:

255.255.255. 1111 1000

Number of subnets: 25 - 2 = 30 Number of hosts per subnet = 23 - 2 = 6.

In the question above, if you work for a company that has a class A address and you divide your network into 2,

097, 150 subnets, then there is a 100 % chance that your IT manager will fire you the next day.

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

Remember these questions from Part 2?

Question 1: Your IP address is 165.247.x.y and your subnet mask is 255.255.224.0. What is the valid range of IP

addresses on your subnet?

Question 2: Your IP address is 165.247.200.100 and your subnet mask is 255.255.224.0. What is the valid range of

IP addresses on your subnet?

Question 3: Your network belongs in class B and your subnet mask is 255.255.240. What decimal values can you

have for the 3rd octet of your IP addresses?

To answer them, you have to memorize about 3 or 4 pages of IP addresses. Or can build the tables from the

ground up. I am not going to get into them here. However, I WILL get into them if someone recreates the tables in

an HTML format and sends them to me. Or if I get over 50 requests, then I'll go into them and demonstrate