Subnetting Tutorial – Subnetting Made Easy
September 28th, 2011Go to comments
In this article, we will learn how to subnet and make subnetting an easy task. The table below summarizes the possible network numbers, the total number of each type, and the number of hosts in each Class A, B, and C network.
Default subnet mask Class A 255.0.0.0 (/8) Class B 255.255.0.0 (/16) Class C 255.255.255.0 (/24)
Range 188.8.131.52 – 184.108.40.206 220.127.116.11 – 18.104.22.168 192.0.0.0 – 22.214.171.124
Table 1 – Default subnet mask & range of each class
Class A addresses begin with a 0 bit. Therefore, all addresses from 126.96.36.199 to 188.8.131.52 belong to class A (1=0000 0001; 126 = 0111 1110). The 0.0.0.0 address is reserved for default routing and the 127.0.0.0 address is reserved for loopback testing so they don’t belong to any class. Class B addresses begin with a 1 bit and a 0 bit. Therefore, all addresses from 184.108.40.206 to 220.127.116.11 belong to class B (128=1000 0000; 191 = 1011 1111). Class C addresses begin with two 1 bits and a 0 bit. Class C addresses range from 192.0.0.0 to 18.104.22.168 (192 = 1100 0000; 223 = 1101 1111). Class D & E are used for Multicast and Research purposes and we are not allowed to subnet them so they are not mentioned here. Note: The number behind the slash notation (/) specifies how many bits are turned on (bit 1). For example: + “/8″ equals “1111 1111.0000 0000.0000 0000.0000 0000″ -> 8 bits are turned on (bit 1) + “/12″ equals “1111 1111.1111 0000.0000 0000.0000 0000″ -> 12 bits are turned on (bit 1) + “/28″ equals “1111 1111.1111 1111.1111 1111.1111 0000″ -> 28 bits are turned on (bit 1) + “/32″ equals “1111 1111.1111 1111.1111 1111.1111 1111″ -> 32 bits are turned on (bit 1) and this is also the maximum value because all bits are turned on. The slash notation (following with a number) is equivalent to a subnet mask. If you know the slash notation you can figure out the subnet mask and vice versa. For example, “/8″ is equivalent to “255.0.0.0″; “/12″ is equivalent to “255.240.0.0″; “/28″ is equivalent to “255.255.255.240″; “/32″ is equivalent to “255.255.255.255″.
The Network & Host parts of each class by default
“Subnetting” means we borrow some bits from the Host part to add to the Network part . For example.0.
. IP 11. we can only create different networks when changing the first octet so we can create a maximum of 255 networks because the first octet can only range from 1 to 255 (in fact it is much smaller because class A only range from 1 to 126).0. we can identify the network and host part of each class. the Network part is now extended.From the “default subnet mask” shown above.1 is in a different network from 11. the IP address 22.214.171.124 because “1″ in the second octet now belongs to the Network part.0. For example.1. Now we have to use a technique called “subnetting” to achieve our purpose.1. we are still in the same Network. Let’s come back to our example with the IP 11.0. we will write all numbers in binary form to reveal what a computer really sees in an IP address. this also means that we can specify how many bits we want to borrow by changing how many bit 0 to bit 1 in the subnet mask.1. This greatly increases the number of networks we can create.0. The problem here is if we want to create 300 networks how can we do that? In the above example.1 belongs to class A and has a default subnet mask of 255.0.0.0. we can borrow some bits in the next octet to make the address 126.96.36.199. By borrowing 8 bits. bit 1 represents for Network part while bit 0 presents for Host part”? Well. if we change the number in the first octet (a block of 8 bits. which is the Host part.1 belong to a different network from 11. 11. For example. How to subnet? Do you remember that I said “in the subnet mask. our subnet mask will be like this:
After changing the second octet of the subnet mask from all “0″ to all “1″.0. the first octet is the leftmost 8 bits) we will create a different network. bit 1 represents for Network part while bit 0 presents for Host part (255 equals to 1111 1111 and 0 equals to 0000 0000 in binary form). Notice that in the subnet mask. With this new subnet mask.
Now you can clearly see that the subnet mask will decide which is the Network part. Now we can create new networks by changing number in the first or second octet.0.0.0.0.1 is in the same network of 11.1. What is “subnetting”? When changing a number in the Network part of an IP address we will be in a different network from the previous address. But if we change a number in the Host part.0.1. For example. 12. This allows us to have more networks than using the default subnet mask.0.1 is in different network from IP 11.0.0.
Therefore the formula should be:
The number of hosts per subnet = 2k – 2
In our example.0.255.255.0000 0000″ but not this: “1111 1111.0? (Please try to solve by yourself before reading the solution ^^) Solution
. The number of borrowed bits is depended on how many networks we need. 1010 0000. Suppose n is the number of bits we borrow:
The number of newly created subnets = 2n
In our example. From here we can deduce the formula to calculate the newly created subnets. which is indicated by the “0″ part of the subnet mask. there are two addresses we can’t assign for hosts because they are used for network address & broadcast address.0000 0000.0 (in binary form) is 16 so we will have 2 k – 2 = 216 – 2 = 65534 hosts-per-subnet! Some other examples Well. in conclusion we “subnet” by borrowing bit “0″ in the Host portion and converting them to bit “1″.0000 0000″.0.0.255. you can borrow like this: “1111 1111. How many subnets and hosts-per-subnet you can create with a subnet mask of 255. 2011Go to comments
Calculate how many networks and hosts-per-subnet In our example. Note: A rule of borrowing bits is we can only borrow bit 0 from the left to the right without skipping any bit 0. But notice that with each subnet. 1100 0000.So. In the next part we will learn how to calculate the number of sub-networks and hosts-per-subnet
Subnetting Tutorial – Subnetting Made Easy
September 28th. each bit can be “0″ or “1″ so with this subnet mask (255. Thus we must subtract the result to 2. practice makes perfect so we should have some more exercises to be familiar with them. how many sub-networks and how many hosts per sub-network do it create?” Note: From now.0. you may raise a question: “when we borrow 8 bits. This term is very popular so you should be familiar with it. For example. In general. The formula to calculate the number of hosts is 2k. How many new subnets? Because we can change any bit in the second octet to create a new subnet. the number of bit “0″ in the subnet mask 255. we will call sub-networks “subnets”. we borrow 8 bits so we will have 2n = 28 = 256 subnets! How many hosts per subnet? The number of hosts per subnet is depended on the Host part. But remember that this is only the beginning in your journey to become a subnetting guru :) Exercise 1 Your company has just been assigned the network 4.0000 0000.0) we can create 28 more subnets. So suppose k is the number of bits “0″ in the subnet mask.255. just make sure all your bit “1″s are successive on the left and all your bit “0″s are successive on the right.0.
0.0. class A ranges from 1 to 126) and its default subnet mask is 255.0 belongs to class B with the default subnet mask of 255.0000 0000 Now use our above formulas to find the answers: The number of newly created subnets = 2 16 = 65536 (with 16 is the borrowed bits) The number of hosts per subnet = 28 – 2 = 254 (with 8 is the bit “0″s left in the 255.0.240) 255.1111 1111.252? (Please try to solve by yourself before reading the solution ^^) Solution In this exercise. Therefore if we use a subnet mask of 255.0000 0000.0 = 1111 1111.128. it belongs to class A (simply.0.255.1111 0000 (=255. How many subnets and hosts-per-subnet you can create with a subnet mask of 255.1111 1111.255.255. let’s write all subnet masks in binary: 255.0 subnet mask) Exercise 3 Your company has just been assigned the network 198. According to Table 1.16.0/28. How many subnets and hosts-per-subnet you can create with a subnet mask of 255.255.255.255. But is the subnet mask of 255.First of all you have to specify which class this network belongs to.255.0.0. Comparing to the default subnet mask.252 subnet mask) In this exercise I want to go a bit deeper into the subnets created. we should write all things in binary:
.255.255.0 subnet mask) Exercise 2 Your company has just been assigned the network 130. it means we borrowed 16 bits (to convert from 0 to 1). Therefore: The number of newly created subnets = 2 2 = 4 (with 2 is the borrowed bits) The number of hosts per subnet = 22 – 2 = 2 (with 2 is the bit “0″s left in the 255. 255.128.1111 1111.0.252 = 1111 1188.8.131.52.255. we borrowed only 1 bit: 255.128.255. So we will compare two subnet masks above: /28 = 1111 1111.0? (Please try to solve by yourself before reading the solution ^^) Solution 130.255. your company was given a “subnetted” network from the beginning and it is not using the default subnet mask.255.0.1111 1111.0 = 1111 1184.108.40.206.0 = 1111 1111.0.1111 1111.0000 0000.0 = 1111 1111.0000 0000 255.0000 0000.1000 0000.255.1111 1100 (= /30) In this case we borrowed 2 bits.0.0000 0000 Therefore: The number of newly created subnets = 2 1 = 2 (with 1 is the borrowed bits) The number of hosts per subnet = 215 – 2 = 32766 (with 15 is the bit “0″s left in the 255.1111 1111.1111 1111. We learned there are 4 created subnets but what are they? To find out.0 strange? Ok.0.0.1111 1220.127.116.11.255.0000 0000 This is a valid subnet because all bit “1″s and “0″s are successive.
01. 10 & 18.104.22.168 to 198.7 Third subnet: ranges from 198.4/30 (the 4th octet is 00000100) Third subnet: 198. It is a boring and time-consuming task.22.214.171.124. So there are 4 values we can use: 00.1 & 198.Because two subnet masks (/28 & /30) only affect the 4th octet so we don’t care about the first three octets.0 and the broadcast address is 198. we convert them back to decimal numbers. In the next part we will learn how to calculate subnet quickly.23.2) as calculated above.16.11 Fourth subnet: ranges from 126.96.36.199/30 (the 4th octet is 00001000) Fourth subnet: 198.0 to 198. After changing.188.8.131.52.23. the network address is 198.23.16. In this part I will show you a shortcut to subnet without using a calculator or rough paper! Subnetting – The quick & easy way One important thing we should notice is that a valid subnet mask must have all bit “1″s and “0″s successive. 2011Go to comments
In the previous examples.23.23.23. In the 4th octet we are allowed to change 2 bits (in the green box) of the IP address to create a new subnet. This is also a “must” requirement for CCNA so you have to grasp it. in which bit “1″s must be on the left.184.108.40.206. Therefore we only have 8 situations:
.0 to 220.127.116.11
Let’s analyze the first subnet which ranges from 198.12/30 (the 4th octet is 00001100)
So how about hosts per subnet? Please notice that all these 4 subnets are successive. Pages: 1 2 3
Subnetting Tutorial – Subnetting Made Easy
September 28th.16. In this case.16.23.3 Second subnet: ranges from 198.23.0/30 (the 4th octet is 00000000) Second subnet: 198. After eliminating these 2 addresses we have 2 addresses left (which are 198. This is the reason why we have to subtract 2 in the formula “The number of hosts per subnet = 2 k – 2″.23. bit “0″s must be on the right. Notice that all networks (and subnets) have a network address and a broadcast address.12 to 18.104.22.168.8 to 198. So we can deduce the range of these subnets: + + + + First subnet: ranges from 198.23. we have to write all subnet masks and IP addresses in binary numbers to find out the results. We get 4 subnets: + + + + First subnet: 198.3 and they are not assignable or usable for hosts.16.16.
255. So it is usually the first thing you must find out in a subnetting question.128. which are in red in the above table) and their equivalent decimal values.1111 0000 255.0. In most cases. 12/30 (the 4th octet is 00001100)
.255.1000 0000.192.16.23.22.214.171.124 -> /10 /26 -> 1111 1111.224.248 to 11111000.16.0″ in slash notation form? “/26″ in binary form? “255.0.255. Let’s take an example of the increment number! Did you remember the subnets in “Exercise 3″ in the previous part? By changing bits in the Network part.0000 0000 248.23.0″ in binary form? “248.1111 1111.0. you can quickly convert the 4th octet of the subnet mask 255.0″ in binary form? “255.248 (by thinking “/24 is the default subnet mask of class C so /29 will have the right-most bit “1″ at 5th position).126.96.36.199/30 (the 4th octet is 00001000) Fourth subnet: 198.255.224. if you can find out the increment.0.0 -> 1111 1111.0000 0000.0000 0000 255.1111 1111. this table is used to quickly convert a number from decimal to binary value without any calculation.0.4/30 (the 4th octet is 00000100) Third subnet: 198. you can find all the information to solve a subnetting question.1111 1111. Or if you are given a subnet of /29 you will know it equals to 255. we found out 4 subnets: + + + + First subnet: 188.8.131.52. Try to practice with these questions: + + + + + + “/28″ in binary form? “255.1100 0000 255.1111 1111. Make sure you remember the right-most bit “1″ position (the least significant bit 1.Table 2 – lists all valid subnet masks
This is a very important table to do subnet quickly! Please take some time to learn it by heart.1110 0000. The increment number is the number specifying how “big” your subnets are.0 -> 1111 1111.1111 1111. For example.0″ in slash notation form?
(Please try to solve by yourself before reading the solution) Answers: + + + + + + /28 -> 1111 1111.0/30 (the 4th octet is 00000000) Second subnet: 198.0 -> /5
How to find out the increment number? The increment is the heart of subnetting.16.255.
16.252 -> x = 252 (x belongs to 4th octet) Therefore the Increment = 256 – 252 = 4 The initial network 198.255.248) + In a subnet mask of 1111 1111.16.252?
.255. x = 255 Note: Also remember which octet “x” belongs to because we have to plus the increment to that octet.0/28. Consider the rightmost bit “1″.4/30 because the increment is 4 so we plus the network address with it to get the next network address (0 + 4 = 4) + The third subnet: 198. The table below summarizes the decimal values of bit “1″ depending on its position.23.224.255. from 8 -> 12) There are 2 popular ways to find out the increment number: 1) Use the formula:
Increment = 256 – x
In which “x” is the first octet (counting from the left) which is smaller than 255 in a subnet mask.12/30 (8 + 4 = 12) Note: We know there are only 4 subnets because we borrow 2 bits.0 -> x = 224 + In a subnet mask of /29 -> x = 248 (because /29 = 255.0/30 + The second subnet: 198.252? The subnet mask is 255.255. you should learn by heart this table:
Table 3 – How to find out increment based on the “least-significant” (rightmost) bit 1
Now let’s solve Exercise 3 again by using this method: Exercise 3 one again (with the “decimal value of the rightmost bit 1″ method): Your company has just been assigned the network 198.16.255 (which is very rare in CCNA). Now let’s solve Exercise 3 again by using this formula: Exercise 3 one again (with the formula 256 – x): Your company has just been assigned the network 198.8/30 (4 + 4 = 8) + The fourth subnet: 198.23.16. the decimal value of this bit is the increment value.23. so: + The first subnet: 198.16. How many subnets and hosts-per-subnet you can create with a subnet mask of 255. 2) Learn by heart the decimal value of the rightmost bit “1″ in the subnet mask: Another way to find the increment value is to write “x” in binary: 11110000.0/28 is also the first subnet. For example: + In a subnet mask of 255. To use this method. from 4 -> 8.0000 0000.1111 1100.255.0. How many subnets and hosts-per-subnet you can create with a subnet mask of 255.23.23.0/184.108.40.206.In this case the increment is 4 (in the 4th octet) because the “difference” between two successive subnets is 4 (from 0 -> 220.127.116.11.255.0000 0000 -> x = 252 In the case you see a subnet mask of 255.16. In this case it equals to 16.23.
23. by using the formula Increment = 256 – x you are trying to separate the rightmost bit “1″ from other bits: 256 – x = 255 – x + 1 In which “255 – x” will convert all bit “0″s to bit “1″s and all bit “1″s to “0″s while “+1″ part will make our result have only one bit “1″ left. so: + The first subnet: 198.com/ccna-subnetting-questions-2 http://www.16.12/30 (8 + 4 = 12) Note: We should only choose one method to use and try to practice.9tut. The initial network 198. only practice makes perfect! Below lists some subnetting questions you can practice with: + + + + + + http://www.16. if x = 240 then:
So in fact we can say two above methods are the same! Now you learned all necessary things to become a subnetting guru.com/ccna-subnetting-questions-4 http://www.9tut.16.com/ccna-subnetting http://www.0/30 + The second subnet: 198.16.0/28 is also the first subnet.8/30 (4 + 4 = 8) + The fourth subnet: 198.9tut.23.net/icnd2/icnd2-subnetting
(Please try solving them before reading the answers ^^) Pages: 1 2 3
.First use Table 2 to convert 252 to 1111 1100. For example.23.23.9tut.net/icnd1/subnetting http://www.4/30 because the increment is 4 so we plus the network address with it to get the next network address (0 + 4 = 4) + The third subnet: 198.9tut.9tut. In fact. Please take some time to practice as much as possible. Practice until you can solve any subnetting questions within 20 seconds! Maybe you will ask why 256 can help you find the increment.23. The decimal value of the rightmost bit “1″ is 4 (according to Table 3) -> The Increment is 4. After finding out the increment we can deduce 4 subnets it creates.com/ccna-subnetting-questions-3 http://www. practice & practice more with it.16.