You are on page 1of 13


Submitted to:Mrs. Barkha Bahl

Submitted By:Mohit Sikka (127) Tushar Chandhok (128)

A subnetwork, or subnet, is a logically visible subdivision of an IP network.The practice of dividing a network into two or more networks is called subnetting. All computers that belong to a subnet are addressed with a common, identical, mostsignificant bit-group in their IP address. This results in the logical division of an IP address into two fields, a network or routing prefix and the rest field or host identifier. The rest field is an identifier for a specific host or network interface. The routing prefix is expressed in CIDR notation. It is written as the first address of a network, followed by a slash character (/), and ending with the bit-length of the prefix. For example, is the prefix of the Internet Protocol Version 4 network starting at the given address, having 24 bits allocated for the network prefix, and the remaining 8 bits reserved for host addressing. The IPv6address specification 2001:db8::/32 is a large address block with 296 addresses, having a 32-bit routing prefix. In IPv4 the routing prefix is also specified in the form of the subnet mask, which is expressed in quad-dotted decimal representation like an address. For example, is the network mask for the prefix. Traffic between subnetworks is exchanged or routed with special gateways called routers which constitute the logical or physical boundaries between the subnets. The benefits of subnetting vary with each deployment scenario. In the address allocation architecture of the Internet using Classless Inter-Domain Routing (CIDR) and in large organizations, it is necessary to allocate address space efficiently. It may also enhance routing efficiency, or have advantages in network management when subnetworks are administratively controlled by different entities in a larger organization. Subnets may be arranged logically in a hierarchical architecture, partitioning an organization's network address space into a tree-like routing structure.

Subnet Mask:
A mask used to determine what subnet an IP address belongs to. An IP address has two components, the network address and the host address. For example, consider the IP address Assuming this is part of a Class B network, the first two numbers (150.215) represent the Class B network address, and the second two numbers (017.009) identify a particular host on this network.

Specific Addresses (IPV4)

The range of available IP addresses is divided into classes. Specifically these are class A, B and C addresses. There are two further classes, D and E. These are not used for addressing purposes currently and this course will not concentrate on classes D or E. IP numbers that begin with a number in the range 1 to 127 are class A addresses. IP numbers that begin with a number in the range 128 to 191 are class B addresses.

IP numbers that begin with a number in the range 192 to 223 are class C addresses. IP numbers that begin with a number in the range 224 to 239 are class D addresses. IP numbers that begin with a number in the range 240 to 255 are class E addresses.

Reserved numbers
There are certain numbers within the IP scheme that have been reserved. No network number may consist of all 0s or all 1s. This means that no network ( or sub network) may take these numbers Any IP number that has the host octet set to 0 is reserved as a network address. Any IP number that has the host octet set to 255 is reserved as a network broadcast (a message for all hosts) address. All numbers that begin with 127 are reserved for the loopback test of a network interface card. This uses The rest of the 127 numbers are wasted here. Class A Addresses (1 to 127) This equates to a /8 address range A typical class A address (in dotted decimal notation) would be In binary notation this is 00001010.11010101.00101011.01111010 Note that the first 8 bits are the network identity and the last 24 bits are host identity.

This means that there are a possible 224 = 16 777 216 combinations available for the last 24 bits. If we subtract the two combinations that cannot be used as host addresses we now have the total number of hosts that can be on a class A network address.

Therefore a class A address can have 16 777 216 - 2 = 16 777 214 different hosts.

Class B Addresses (128 to 191) This equates to a 16 address range A typical class B address (in dotted decimal notation) would be In binary notation this is 00001010.00010001.00101111.01100100 Note that the first 16 bits are the network identity and the last 16 bits are host identity.

This means that there are a possible 216 = 65 536 combinations available for the last 16 bits. If we subtract the two combinations that cannot be used as host addresses we now have the total number of hosts that can be on a class B network address. Therefore a class B address can have 65 536 - 2 = 65 534 different hosts. Class C Addresses (192 to 223) This equates to a /24 address range A typical class C address (in dotted decimal notation) would be In binary notation this is 00001010.00010010.11000111.00001100

Note that the first 24 bits are the network identity and the last 8 bits are host identity.

This means that there are a possible 28 = 256 combinations available for the last 16 bits. If we subtract the two combinations that cannot be used as host addresses we now have the total number of hosts that can be on a class C network address. Therefore a class C address can have 256 - 2 = 254 different hosts.

Network Address
The network address of the host having IP number ( unsubnetted class B address) is This can be easily seen as this is an unsubnetted class B address. this address would today be written as /16 To work this out, first convert this IP number to binary: /16 = 10000001.11101100.01111111.00101100 The first 16 bits are the network identity. Replace the host identity section of the address with 0s. 10000001.11101100.00000000.00000000 If we convert this back to decimal we get It is important to note that hosts on a particular network cannot communicate directly with hosts on a different network, even if they are on the same network segment!

Broadcast Number
Sometimes it is necessary to send a message to all the hosts in a network. This is done using a broadcast address. To obtain the broadcast address number for a network, substitute the host section of the binary version of the IP address with 1s. With the / notation this means setting the last bits (32 - /number) to zero.

For the address above /16, the broadcast address would be To work this out, first convert this IP number to binary: = 10000001.11101100.01111111.00101100 The first 16 bits are the network identity. Replace the host identity section of the address with 1s. 10000001.11101100.11111111.11111111 If we convert this back to decimal we get

Subnetting and Supernetting

Subnetting is the process of creating new networks (or subnets) by stealing bits from the host portion of a subnet mask. There is one caveat: stealing bits from hosts creates more networks but fewer hosts per network. Consider the following Class C network: The default subnet mask for this network is This single network can be segmented, or subnetted, into multiple networks. For example, assume a minimum of 10 new networks are required. Resolving this is possible using the following magical formula: 2n The exponent n identifies the number of bits to steal from the host portion of the subnet mask. The default Class C mask ( looks as follows in binary: 11111111.1111111.1111111.00000000 There are a total of 24 bits set to 1, which are used to identify the network. There are a total of 8 bits set to 0, which are used to identify the host, and these host bits can be stolen. Subnetting is one of those things that most tutorials and books make far more complicated than it should be. When I began studying for the TCP/IP MCSE exam, I was at a loss. After a lot of browsing through the bookstores and web pages, I realized that it's actually quite simple. Although in the real world, most people use subnet calculators--they're available as freeware, so cost isn't an issue-- for ones own knowledge (and of course, the TCP/IP test) one does have to know how to manually figure out subnets. Despite the fact that many

are saying (and this matched my own experience) that there are only one or two subnetting questions on the test these days, MS can be whimsical, and this could change again. Although the TCP/IP exam is going to be retired, MS expects to be familiar with the material that it covers for some of the new Windows 2000 core exams. This is a howto, not a whyis. If you want detailed explanations, including ANDing etc, see one of the many excellent sites on the web. There are three basic aspects to subnetting--determining how many subnets you need, how many hosts it will allow and what are the valid addresses on the subnet. There are several complicated formulas to work this out, most involving binary math. One can memorize several tables, or, if they are good at this sort of thing, do it in their head. If one does use the calculator provided with Windows, especially on the test. The operation have to perform are the following--converting binary to decimal, which is done by hitting the F6 key. Converting decimal to binary, which is done by hitting the F8 key. The information below is also useful both in the real world and on the exams for IIS4 and Proxy 2.0. In both cases, a range of addresses can be permitted or denied access based on subnet masks.

This now leaves 12 bits for the host identity = 212 = 4096 but remember that the first and last numbers are reserved. This leaves scope for 4094 hosts on each network. To show where the network/ host boundary lies the / notation informs us of the number of network bits - this is the sum of the network and borrowed bits. In the example above, there are now 20 network bits so this is a /20 address. Original single class B address is divided into 2 subnetworks 24 = 16 subnetworks. Unfortunately we cannot use the first or last of these addresses. Therefore we have the potential for 16 - 2 = 14 networks within our original class B address. This allows for 14 networks with 4094 hosts (maximum) residing on each subnetwork. The examples with a class C address, as that is the simplest. However, this will work with the other classes as well. Let's say a network that begins with the network address then is is the address representing the entire network, divide it into 6 subnets, the default subnet mask is , one need to change it (As an aside, see a subnet written as instead of being written out as The number behind the slash indicates the number of ones in the subnet if it is written in binary. For example, is written in binary as

11111111.11111111.11111111.00000000 [usually without dots between the bits--I simply put them there for the reader's convenience]. Therefore, This is called slash notation.) Now find that preperation tests and textbooks use slash notation or terms like 6 bits of subnetting. This USUALLY means 6 bits in addition to the default subnet mask. For instance. A default class B netmask is or 11111111.11111111.00000000.00000000 in binary. 6 bits would be 11111111.11111111.11111100.00000000 or One has to be careful however--if they say a class B address with 26 bits of subnetting, then they mean 26 bits total. As a subnet mask consists of 32 bits, and a class B netmask consists of 16 bits, it isn't possible to add 26 additional bits. So be careful. There is a very simple formula here. 2^n-2=X. X has to be equal to or greater than the number of desired subnets. So, 2^2=4. 4-2=2. Nope, not enough. So, 2^3=8. 8-2=6. That's how many bits we need to take from the host address part of the subnet to make our subnet mask. Take the three bits. Now, take those three bits and putting them at the left side of this octet--more properly referred to as putting them in high order. Our new final octet is 11100000. Then, either using the table you've memorized, or your windows calculator, put this back into decimal form. It is 224. Our new subnet mask, one that will allow us to have 6 subnets is There is another method that some might find easier. If one remembers that 10000000 in binary is 128 then each bit to the right of that first represents half of the preceding number. So, take three bits. The first bit, if there were no others, would be 128. The second 1, counting from the left, is half of that, 64. The third is 32, etc. So, one can simply add 128+64+32 to get your 224. Use whichever method works best for you. Sometimes, one might want have a problem that goes the opposite way--with a given subnet mask, how many subnets one has. It's solved in the same general way. Put the changed octet into binary, count the 1's then use the 2^n-2 formula. So, if one has a subnet of, and you want to know how many subnets can be made with it, write the 224 in binary. 11100000. Three 1's---2^3-2---you can have 6 subnets One may be presented with a problem that gives you class B address with what looks like a class C subnet, for example and a subnet of What's happened here is that one now have a ridiculous number of subnets, with 30 hosts each. Judge the class by the IP address, not by the subnet. The next part is to figure out how many hosts can be on each subnet. One may lose some address per subnet, because one can't have all 0's or all 1's. Additionally, certain addies are used for the subnet ID. This is only a how to--there are many good, though often complicated, explanations of why out there. So, moving right along

Going to binary, we count the remaining 0's in the last octet, the one that we changed to make our new subnet. One can change the 0 to 224. Written in binary, this is 11100000. We have five 0's. So, 2^5=32. 32-2 = 30. One has 30 hosts on each subnet. If this were a class B address, the original subnet would have been and would have changed the third octet to 224, giving us a subnet of In binary, that would be 11111111.11111111.11100000.00000000 so one would have the 8 additional zeros of the last octet. Then the equation would have been 2^13-2. This is the easy way to figure out how many hosts are allowed on each subnet. If one need 59 hosts per subnet, what subnet mask should you use. In problems like this, it's helpful to have memorized your tables, however even if you haven't, it isn't that difficult. Remember that the number of possible hosts is determined by the number of 0's in the subnet mask. So, if it's a higher number of hosts, like 59, especially if we're using a class C address, start with a lot of 0's. If one hasn't memorized the 2^x tables, simply estimate. Obviously, one or two 0's isn't going to do it, so start high, with 2^6 (which gives us 62 hosts--2^6=64-2=62) which is the correct number. This gives the necessary number of host bits (remember, 1's are for the network and 0's for the host) that can use if we need 59 hosts per subnet. Take 11000000 and put it back into decimal and one can see that to allow 59 hosts for each subnet, the subnet mask should be One thing that is found helpful to remember is that the more ones in the octet, the more subnets one can have--the more 0's, the more hosts one can have. Lastly, one want to determine the range of valid host IP addresses on each net. People do this in different ways--one is again counting the 0's (only of the changed octet--in a class A or B you leave the other 1 or 2 final octets alone) and doing 2^ the number of 0's. In the example mentioned earlier, where one wanted 6 subnets so we used the subnet mask of, one has those five 0's as 224 in binary is 11100000, (To reiterate--in a class A or B address, one still only is using the five 0's of the changed octet--in other words, if your class A subnet is now we're only working with the .224) and we get 32. The other way to come up with the number is to use the changed subnet octet, in this case, 224, and subtract it from 256. Again, the answer is 32. Either way works, do whichever is easiest --take the number of 0's from the changed octet and go 2^ that number or just subtract the new decimal number from 256. So, if subnet was, one could, write it in binary go 11111000 and do 2^3=8 or subtract 248 from 256 again winding up with 8. This number that we have just found is going to be used to determine our subnet IDs. The subnet ID is the network address of the subnetwork. Old network address was with a subnet mask of It's now going to be with a subnet mask of The subnet IDs will be incremented by 32's. If subnet mask had been, then the first subnet ID would have used that 8 that we got from subtracting 248 from 256. First subnet would have been, the second one would have been etc. In this case, it's,,,,, The next time we add 32 we get can't use that address because it's higher than the 224 that using for our subnet mask. It's worth repeating that the higher the changed octet number, the more subnets one get but the fewer hosts per subnet. If one had used the subnet mask of, we would have an octet reading 11111000. Using formulas, to find how many subnets one could make, 2^5-2 which gives 30. 30 possible subnets. To find hosts---2^3-2---only 6 hosts on each subnet. So, going back to subnet---the network address, or subnet ID is So, the first host addie is lost the first and last ranges of addresses-- can't use, nor will be able to use anything higher than on the last subnet. Especially with class C addies, it can get a bit confusing. Basically, to figure out our valid host ID's, remember one can have 30 hosts on each subnet. The first one would be The network address of this subnet--which used to be before we started subnetting--is now The second subnet's network address is would think that one could, on the first subnet, use the host address of, in binary, comes out to be all ones, so one can't use it as the addie can't be all 0's or all 1's in binary. The easiest way to do it is to simply remember the number 30 (32-2) and add it to each subnet ID. Therefore, 32+30=62--the first range of host IDs goes from to Then, we can't use .63, . 64 is the next subnet ID so one can't use that one either. (this is one of the many ways you lose host IDs by subnetting). So, the next subnet begins with Remember-30 hosts per subnet. 65+30 =95. However, keep in mind, 65 is first host ID on this subnet. Therefore, it counts as number one and one can only have 30 hosts. So, add 30 to the NETWORK address of The last address on this second subnet is The easiest way (for me at least) to keep this straight is to go back to the problem of how many hosts can be on a subnet. In this case, as one has a subnet of .224 which in binary is 11100000, we count the zeros, find 5 of them go 2^5-5=30 and know one can have 30 hosts on this subnet. Then add thirty to the subnet ID. Let's go to the subnet of to make sure we have this down. Remember, 248 in binary is 11111000. So, one can have 2^5-2 subnets, i.e. 30. And can have 2^3-2 hosts per subnet, or 6. 256-248 (or 2^3)= 8 so our subnet ID's are going to be in increments of 8. Our first subnet will be The second one will be, etc.

Subnet Mask
This term is often used in place of the real name, 'extended network prefix'. It is used to help determine which part of the IP address refers to the network and which part refers to the host. A subnet mask is 32 bits long and has 4 sections or octets that are separated by dots the same as an IP address. To work out the subnet mask for a particular subnetwork IP address follow the steps below. 1. Express the subnetwork IP address in binary form. 2. Replace the network and subnet portion of the address with all 1s. 3. Replace the host portion of the address with all 0s. 4. Now convert the binary expression back to dotted-decimal notation.

What is the subnet mask for the subnetted class C address ( /24) that has borrowed 3 bits from the host field? 1. Change decimal to binary: 11000111.10110001.10100110.00100010 3 bits have been borrowed from the host field. These are denoted in green above. This means that the network identity part of the IP address is 27 bits long. 2. Substitute 1s for these 27 bits 3. Substitute the last 5 bits for 0s 11111111.11111111.11111111.11100000 4. Convert back to dotted decimal or we can write the subnet mask as /27 This is the subnet mask for the above network number.

Using the Subnet Mask

When making routing decisions, a router will use the subnet mask and the IP address of the host to work out the network number. The Boolean operator AND is used here. The IP address is ANDed together with the subnet mask to obtain the network number.

Example: What is the network number for the IP address given that the subnet mask is ( or /27) 1. Convert both numbers to binary IP Address = 11000111.10110001.10100110.00100010 Subnet Mask = 11111111.11111111.11111111.11100000 (note the 27 binary 1s) 2. AND these two numbers together 11000111.10110001.10100110.00100010 11111111.11111111.11111111.11100000 11000111.10110001.10100110.00100000 3.Convert back to dotted decimal This is the network identity. AND

Supernetting, as might be guessed, is more or less the opposite of subnetting. Rather than making additional subnets, one takes a group of subnets and combines them into one. It's actually a little easier than subnetting, because, as will be explained below, rather than a formula of 2^n-2, one simply uses 2^n. The subnets must be contiguous. For instance, three subnets of, and Note that the third octets are consecutive, 1, 2 and 3. So, rather than take (in binary) 0's from the host portion of the address and making them ones, we're taking 1's and making them zeros. The formula in this case, rather than 2^n -2 is simply 2^n. One need to combine three subnets. If one need to MAKE three subnets, try 2^2-2. 4-2=2, not enough, one has to go to 2^3=8. 8-2=6, and therefore, one would have changed 3 0's in the last octet to 1's, changing subnet mask from to However,COMBINING 3 subnets into one this time. So, one has three subnets,, and, all of which have a subnet mask of 2^1=2. Nope, not enough. 2^2=4. 4 is larger than 3, so that gives us enough. One has to change 2 1's in the third octect to 0's. So, in binary, we have 11111111.11111111.11111111.00000000. Changing 2 of those ones in the third octet to

0's. So, one has 11111111.11111111.11111100.00000000. The new subnet mask is Suppose one has 8 subnets that one want to combine. First, what power of 2 equals or is greater than 8? 2^3=8. Ok, one need to knock off 3 1's from the third octet. So, a subnet mask of will enable to combine the 8 subnets into one. Instead of changing 0's to ones, beginning at the left side of an octet, changing ones to 0's, beginning at the right side of the octet. The subnets that are being combined must be contiguous, such as,, etc. At least for test purposes, one can't combine, and Figure out how many subnets you are combining. Figure out which power of 2 is equal or greater to that number, eg if it's 8 subnets that one is combining, what is n in 2^n=8. If it was just two subnets being combined, then it would be 2^1=2. If three subnets, then 2^2=4, if 5 subnets then 2^3=8, etc. Whatever n turns out to be, that's how many 1's one is taking away--from the RIGHT side of the octet, and changing them to 0's. One probably have either memorized, or have your own method by now for remembering that 10000000 is 128, 11000000 is 192, 11100000 is 224, etc. So, if one change the last 2 1's of to 0's that will be 252. If one change three 1's to 0 it will be 248, etc. One can of course, simply memorize tables again, but it probably isn't necessary. There were never more than 16 subnets to be combined, meaning that if you simply remember 240, 248, 252 and 254, you'll be fine. (For 16 subnets to be combined one would go 2^n=16. n=4. Take the last 4 1's of the third octet and make them 0's. This gives 11110000 in binary, or 240 in decimal.