spacer
spacer search

Miller Family Site
For family and friends

Search
spacer
Newsflash
header
Main Menu
Home
News
Family
The Web Links
Newsfeeds
Computing
Picture Gallery
Neighborhood
Site Map
Administrator
Old Content
Login Form
Username

Password

Remember me
Password Reminder
No account yet? Create one
 
Home

Subnetting Paper PDF Print E-mail
User Rating: / 0
PoorBest 
Written by PCDreams   
Sunday, 01 May 2005

Subnetting

 

Don Scroggins

 

Net 260, Section 2, Spring 05

 

 

IPv6 is the wave of the future. It’s going to ring in the age of classless network addressing. This is indeed great news however; the reality is that IPv6 implementation will take years. Only a few web hosts are using IPv6, and not many routers are currently supporting it.  So while it’s great to be looking at what tomorrow holds, we need to keep focused on the work that needs to be accomplished today.

As network administrators we need to have the ability to not only troubleshoot hardware and software, setup routers and ACL, but to also be able to design and implement a network from the ground up. While most of us may never get the opportunity to do so; it’s always good to know how. With current trends leading toward downsizing, you never know when you may be the IT department.

Today focus is on subnetting. Subnetting is taking one large network and breaking it down into two or more smaller networks. Why would you want to do this? Creating broadcast and collision domains will reduce network traffic thus providing more bandwidth and increased network performance. Perhaps you have been assigned a class B network and you have two or more offices that need to share those addresses. There are many reasons but these are the most common.

Subnetting deals with the current IP addressing standard (IPv4). This addressing scheme consists of using a 32 bit number to represent a hosts or device on a network or the network itself (network id and broadcast address). The IP address is subdivided into four octets containing eight bits each. This is done to make it simpler for humans to read. Also note that the address you see, such as 192.168.3.1, is only a decimal representation of the value. If you take a look at this same address in binary (11000000.10101000.00000011.00000001) you will see where each of the eight bits are.  But how do we extract the decimal values from the binary? The easiest way to do this is by creating a chart.  You will want a chart with eight columns. You will want to number the columns from right to left starting with 1; each value will double until you arrive at 128. So you should have a chart with the values 128, 64, 32, 16, 8, 4, 2, 1. Another way to think of this is the values increase by powers of 2. Example 28, 27 etc, remembering any number to the power of zero is equal to one.

With this chart we can determine that the largest number possible in eight bits will be represented by a one in each place on the chart. Thus if you add the value at the top of the chart for each place where there is a one you would arrive at 255 (128+63+32+16+8+4+2+1). By using the same method you can see the lowest value would be zero. This same method is used throughout subnetting to find binary or decimal values.   

            Now that we know how binary and decimal conversions are performed, let’s take a look at address classes. There are five classes of IP addresses that exist on the internet (classes A-E); each assigned for different uses and with different capabilities.

            Class A networks will support roughly 17 million hosts. This is more than most entities require therefore this address range has been reserved for governments and large corporations world wide. If you look at a binary chart, the value of a class A network will always start with a zero in the left most column. This also tells you that the highest value for the first octet of a class A network will be 127 (64+32+16+8+4+2+1). This means that the range of Class A addresses runs from 0.0.0.0 – 127.0.0.1. Remember however that the entire 127.0.0.0 network cannot be used; it is reserved as the loopback address.

            Class B networks support roughly 66 thousand hosts. This range falls to the large and medium sized businesses.  Class B addresses always starts with one and zero in the first two columns. This tells you that your range of addresses will be 128.0.0.0-191.0.0.0.

            Class C networks support 254 hosts. They are assigned to small businesses or organizations that don’t require large networks. The first three binary digits of a class C network will be 110. This tells you that the range of available addresses will be 192.0.0.0-223.0.0.0.

            Class D networks range from 224.0.0.0 – 239.0.0.0. These addresses are used for multicast. Class E networks range from 240 upward. These are experimental addresses. We won’t be discussing these last two classes because they are not typically used by the public; they are included here for completeness.

            If you think about the discussion of the classes; you can see by looking at a binary chart which class of network you are working with. Class A has the last seven bits configurable (0xxxxxxx), class B the last 6 (10xxxxxx), and class C the last 5 (110xxxxx).      

            As mentioned previously, IP addresses represent both hosts and network. This does not mean that the division between the two has to be divided at each octet, though by default it is. The default subnet masks are:

            Class A 255.0.0.0   = 11111111.00000000.00000000.00000000

             Class B 255.255.0.0 = 11111111.11111111.00000000.00000000

             Class C 255.255.255.0 = 11111111.11111111.00000000.00000000

            The subnet mask is a consecutive string of ones (binary digits). Each host on a network uses the IP address and subnet mask to determine if an address is local or remote. It does this by performing an ANDing operation. The way ANDing works is each bit of an IP address is compared with each bit of the subnet mask and an ANDing result is returned. A one and a one results in a one, all other combinations result in zero. When the device ANDs the IP with the subnet mask the result returns the network ID. Luckily most ANDing operations are performed by routers; I am including examples here as I feel it will help you understand subnetting.

            Suppose you want to send a packet to a host at 64.168.5.7 and your IP address is 64.168.1.1. Is the destination a local address? Or does the packet need to pass through a router? Let’s find out using ANDing.

 

 

 

Your local IP is 64.168.1.1    or              01000000.10101000.00000001.00000001

Your subnet mask 255.255.255.0 or       11111111.11111111.11111111.00000000

ANDing Result                                        01000000.10101000.00000001.00000000                                                

Thus your network ID                             64.168.1.0

You want to send a packet to:

Destination IP is 64.168.5.7     or           01000000.10101000.00000101.00000111

Subnet mask 255.255.255.0     or           11111111.11111111.11111111.00000000

ANDing Result                                        01000000.10101000.00000101.00000000

Network ID                                              64.168.5.0

These two hosts are remote using the given subnet mask

We can also use ANDing to find out what subnet mask would need to be used to make these two hosts local.

Your local IP is 64.168.1.1      or           01000000.10101000.00000001.00000001

Your subnet mask 255.255.0.0 or          11111111.11111111.00000000.00000000

ANDing Result                                       01000000.10101000.00000000.00000000

Thus your network ID                             64.168.1.0

You want to send a packet to:

Destination IP is 64.168.5.7     or           01000000.10101000.00000101.00000111

Subnet mask 255.255.0.0         or           11111111.11111111.00000000.00000000

ANDing Result                                        01000000.10101000.00000000.00000000

Network ID                                              64.168.5.0

These two hosts are local.          

            While these results seem confusing at first, you can see by looking at the subnet mask that they make sense. In both examples above we start with a class A address. The address is then subnetted in the first example to a class C network. Using the default subnet mask for the class C network, only the last octet can be subnetted. This means that anytime anything in the first, second or third octets are changed, the hosts with those address are going to be remote.

            In our second example we are subnetting to a class B network. Using the default class B subnet mask, the last two octets can be used for hosts. Regardless of what you change in the last two octets, the hosts will be on the same network. If you change anything in the first two octets however, then the hosts become remote.  

            You cannot have a zero host identifier, because zero is reserved for network ID. You also can’t use 255 as that is the broadcast ID. We’ve already seen how to determine network IDs but let’s take a look at broadcast IDs.   

            Broadcast IDs can also be determined using the ANDing process.

Source IP:        199.192.65.0              11000111.11000000.01000001.00000000

Subnet mask    255.255.255.0            11111111.11111111.11111111.00000000

ANDing result                                    199.192.65.255    This is the broadcast address

 

With the default subnet mask being used in this example, it is a fairly straight forward process to see what the broadcast address would be without having to do the math. Since the last octet in the subnet mask contains a zero you know that 199.192.65.255 will be the broadcast ID.

            The monkey wrench to the process comes into play when you start masking portions of octets. Here is another example.

IP 199.192.64.32                                11000111.11000000.01000001.00000000

Subnet mask   255.255.255.224         11111111.11111111.11111111.11100000

ANDing Result                                   199.193.65.63 is your broadcast address.

 

Unless you’re use to thinking in binary, this example wouldn’t be as obvious as the previous. This is why, when you first start subnetting, it is vital to make a chart and work with examples until you are comfortable. I’ve been doing subnetting for awhile; I still feel more comfortable sitting down with a chart and working things out.

One of the main goals of subnetting is breaking a large network into smaller networks. This can be done for many reasons, typically to save namespace, increase network performance, reduce collisions or divide a network segments that reflect an organizational structure. Keep in mind that subnetting only affects the LAN.

There have been addresses set aside for private IP addresses. These ranges include:

            Class A - 10.x.x.x

             Class B – 172.16.x.x-172.31.x.x

             Class C – 192.168.x.x

 

These addresses are used for use internally and are not routable on the Internet.

            So far we’ve only discussed the more technical aspects of how networks are recognized using a router. But let’s give our brains a rest for a moment and look at what subnetting does in a less “machine language” way.

            Suppose you are assigned the network address 190.45.0.0. You are already aware that this is a class B network address with around 66 thousand addresses available. At this time you only have 250 hosts you need to connect. You also know that the default subnet mask for class B is 255.255.0.0. this leaves two octets usable by hosts. You decide to use the class C default subnet mask of 255.255.255.0 instead. This allows you to create 254 networks with 254. This also leaves you plenty of room for future expansion. If this were a real situation you would of course want to use an even more restrictive subnet mask and have fewer hosts per segment.

            Creating custom subnet mask can be quite a challenge. However the benefits are well worth the effort. Keep in mind that when you subnet you will lose addresses. This is do in part to having a network ID and Broadcast ID for each network.

            A simpler way to determine how many networks and how many hosts you will have is to refer once again to a binary chart. Starting on the left number from one to 128 (in powers of two). You will do this above your existing numbers. Also place an X over the 1.  Label the line you just created “number of networks”. Name the original line “number of hosts”. Now when you fill in the numbers for the subnet mask, you will be able to see where to stop, based on number of networks and/or hosts you require. Keep in mind that a subnet mask must have all the one bits consecutive. Here is an example.

You are given the IP 192.168.1.0. This is a class C network with a default subnet mask of 255.255.255.0. However you need to subnet this network into segments that will support at least 35 hosts. Using the chart described above you would determine that to meet the requirements for the network you would need to divide the network into 4 networks; each network will support 62 hosts. This will give you a new subnet mask of 255.255.255.192. Each segment supports 62 hosts instead of 64 because each network needs a network and a broadcast ID.  

            To determine your range of addresses take a look at your multiplier. In the previous example it would be 64 (where the subnet mask ends, the value in the hosts row is your multiplier). So you networks ranges would look like the following:

            Net0 – 192.168.1.0 – 192.168.1.63

             Net1 – 192.168.1.64 – 192.168.1.127

             Net2 – 192.168.1.128 – 192.168.1.191

             Net3 – 192.168.1.192 – 192.168.1.255

 

As you can see we now have network IDs and broadcast IDs that are different than one and zero.

 

The network IDs are now the first number of the network (ex 192.168.1.64) and the broadcast address is now the last number of the network (ex 192.168.1.127). I find it easier to set the network numbers first by using the multiplier. Then coming back and filling in the broadcast id. This keeps you from getting confused about network id and broadcast id.  Remember when you want to know the “usable” addresses you will add one to the network ID (ex 192.168.1.1 would be the first usable address in the Net0 network) and subtract one from the broadcast id (192.168.1.62 would be the last usable address in Net0). Also be aware that with some Cisco hardware you must discard the first and last network. This is something to keep in mind when determining the subnet mask. If you had needed more networks, you would have needed to go one binary digit to the right with your subnet mask to get the correct number of networks, which would also have reduced the number of hosts per segment.

            There are a couple of formulas that you need to know for subnetting. The first deals with the number of usable subnets. 2y -2; where y = number of bits you’ve mask from the octet. In our example that’s two.  The other formula tells you the number of usable hosts. 2x -2; where x = number of unmask bits remaining in the octet. In our example that’s 6.

            So are you tired of hearing (or in this case reading) 255.255.255…..? Well if so you’ll like CIDR. CIDR stands for Classless Inter-Domain Routing. It was created to slow down the exhaustion of IP addresses by allowing creation of subnets outside the default subnet masks (or octets). Cider allows you to use a prefix to denote the network id (or subnet mask). CIDR numbers denote which bit the subnet mask ends on. These bits start at the far left column of our chart and continue through each octet. So for instance a network with a subnet mask of 255.255.0.0 would be denoted as a /16 network with CIDR. This makes it simpler to not only convey info to others in the field but also easier to figure out the subnet mask. For instance, suppose you are told you have the 64.124.68.0 /27 network. You know that this network has already been subnetted. It was originally a class A network (/8). With this info you can quick determine that your subnet mask is now 255.255.255.224 (first three bits in 4th octet was used). This also tells you can have four subnets with 30 hosts on each.

            CIDR can also be used in “supernetting” which is combining subnets. It is being used by most ISP’s and backbone routers in use today. While this system is quite handy and much simpler than the original class system; you must have a good grasp of the class system to effectively use CIDR.

            Supernetting, which is also called summarization or route aggregation is the combining of subnets. This process is mostly carried out by routers and so we won’t get deep into it; it should be noted that supernetting moves the subnet mask from right to left instead of left to right like in subnetting. This allows the router to see several subnets as one, thus reducing its routing table. Large routing tables can cause degradation in router performance and thus should be avoided where possible. It should be noted that only consecutive subnets can be supernetted together.          

            Subnetting is a great way to divide large networks into smaller networks but, what happens if you have networks that need far fewer hosts than a subnet will provide? Sure you can create the larger subnet; however you would be wasting a lot of address space.  VLSM or variable length subnet mask eliminates this problem by allowing you to use different subnet mask for each subnet. Basically you will be subnetting subnets. To do this however you must use a newer routing protocol such as RIPv2, EIGRP, or OSPF because older routing protocols such as RIPv1 and IGRP don’t carry subnet mask information.

            While VLSM is not any more difficult than subnetting, it can seem quite confusing at times. I’ve found it easiest to look at each step individually instead of trying to see the whole picture at once.

            Imagine you are given the task of setting up 5 networks. Network one requires 60 hosts, network two requires 28 hosts, network three needs 10 hosts, network four and five need 2 hosts each. Given that our major network id is 192.168.59.0. We know by default this is a /24 network. We need to subdivide this network and the most hosts we need for a subnet is 60. By using our binary chart we can see that to get 60 hosts we will need to mask two bits in the forth octet. Now we have enough addresses to create four networks with 62 hosts each. These networks are 192.168.59.0/26, 192.168.59.64/26, 192.168.59.128/26, and 192.168.3.192/26. The problem that remains is we are short by one network and we have far too many hosts per network for most of the networks.  192.168.59.0/26 we will leave alone. It will support 62 hosts which so we will use it to support our network 1.  We can now mask another bit from the 192.168.59.64/26 network and create two new subnets. These new subnets will be 192.168.59.64/27 and 192.168.59.96/27 each of which will support 30 hosts which we will assign to network 2 and network 3. Finally we can divide 192.168.59.128/26. We only require two hosts for the last two networks so we can mask 4 more bits. This will give us the following networks 192.168.59.128/30 and 192.168.59.132/30 each supporting 2 hosts. This will of course create some unused addresses. For instance we still have the addresses 192.168.59.36 – 192.168.59.188 that are unused as well as the entire 192.168.59.192/26 network.

            Now we know a little about how subnetting works, but what practical application does it have?

This was something that had eluded me until this semester. I’m taking the routing and remote access course and we are starting to work with routers, routing protocols, and routing tables. Uses of subnetting really come into play in that class.

            As an example, suppose you have 5 routers that you want to network together. Routers have at least two interfaces. It stands to reason then that they will also have at least two IP addresses and support at least two network segments. Here is the info you have on the routers:

Router 1:  interface one (E0/0) has an IP address of 192.168.5.254/24

                 interface two (E0/1) has an IP address of  192.168.1.253/26

 

Router 2:  interface one (E0/0) has an IP address of 192.168.1.254/26

                  interface two (E0/1) has an IP address of 192.168.2.253/27

 

Router 3:  interface one (E0/0) has an IP address of  192.168.2.254/27

                 interface two (E0/1) has an IP address of 192.168.3.253/28

 

Router 4:  interface one (E0/0) has an IP address of  192.168.3.254/28

                  interface two (E0/1) has an IP address of  192.168.4.253/29

 

Router 5:  interface one (E0/0) has an IP address of  192.168.4.254/29

                  interface two (E0/1) has an IP address of 192.168.5.253/24

 

From the information given we can see that there are 5 segments that exist. Notice that each E0/1 address on is on the same segment as the E0/0 of the router it connects to. This means that you can ping between these interfaces without any routing, but you are still required to know what the network ID is and to figure that out you need to use subnetting to find the subnet mask. Let’s start with router 1 and 2 and work in a clockwise direction.

            The interface addresses are both 192 addresses. This tells you that by default they are class c and would have a subnet mask of 255.255.255.0, however, the CIDR number is /26, meaning that two bits from the last octet have been mask. If you think about your binary chart then you will remember the first two bits are 128 and 64. Adding these together will tell you that your custom subnet mask is 255.255.255.192 on both interfaces. It also tells you that the first subnet will be 192.168.2.0-192.168.2.63. From this you derive that you network ID for this network will be 192.168.2.0.

            These two routers can now talk. But what if router one wants to talk to router 3 or 4? Each router’s E0/1 is on a different network. Somehow the network must be tied together to talk. Each network is tied to the interface inside the router so shouldn’t they all talk? It’s not quite that simple. The routers need a routing table to talk with the other networks. Continuing on with our example, If router one wanted to talk to router two’s E0/1 interface (and thus router threes E0/0) then router one must create a routing table that includes the network ID and subnet mask for router twos E0/1 interface. We can see that interface has the IP address 192.168.2.253/27. Meaning it has three bits mask in the final octet. Using the chart we can find that the custom subnet mask would be 255.255.255.240 and our network ID would be 255.255.255.240. Furthermore our first network would be 192.168.2.0 -192.168.2.31.

            In this example our routing table would be small. Each router only needs to know the E0/1 interface for the next router. This is because the next router will have the proceeding routers E0/1 interface in its routing table.

            I hope this paper has served to reinforce and perhaps clarify how subnetting works. I know that it can be a difficult concept to grasp; this is why I’ve given so many examples. I’ve also found that, like many things, it is something you quickly forget if you don’t use it. Even if you aren’t actively involved in the roll out of a network, you never know when you may need to expand your network with a new router. If you know how to do subnetting ahead of time you can really shine. Heck who knows, the boss may be so impressed he/she’ll give you a raise. In any case it will show them that you actually know what goes on behind the scenes.

 

 

 

 

Works used

 

http://learntosubnet.com

Notes from my Net 225 course

Notes from my 175 course

CCNA guide to Cisco Networking 3rd. ed

http://www.dslreports.com/faq/5377 (CIDR chart)

 

 

Works Consulted

 

http://www.ralphb.net/IPSubnet/

http://www.cisco.com/warp/public/701/3.html

http://www.freesoft.org/CIE/Course/Subnet/

http://www.j51.com/~sshay/tcpip/ip/ip.htm

 

 

 

 

< Previous   Next >
spacer
Search

 

Mambo is Free Software released under the GNU/GPL License.
spacer