Results 1 to 3 of 3

Thread: Subnetting tutorial

  1. #1

    Subnetting tutorial

    Here is something I put together for my brother who was studying for his CCNA at the time. Subnetting seems to kick peoples arse constantly, so I spent some time with one of our network engineers. This was the outcome of it.

    How-To Subnet an IP Range
    By Mark Birchfield
    Birchfield4@yahoo.com

    To understand how subnetting works, you must first have a good basic understanding of IP Addresses. An Ip address is set of binary octets broken into quads. That probably made absolutly no sense to you, so we will try it another way. An Ip address follows what is called dotted octet notation. There are 4 sets of numbers in an ip address with dots separating them. (ie., 192.168.0.1) Now lets go a bit further into the binary octet part. Binary numbers are broken down by what is known as positional notation. This works from right to left in increasing place values. Here is an example:

    192.168.0.1 in binary octet form would be 11000000.10101000.00000000.00000001

    1 1 0 0 0 0 0 0. = binary form of 192 (Hint: Add up the ones with the numbers below
    128 64 32 16 8 4 2 1 them. First one equals 128 plus second which is 64. Added together this equals…192.

    1 0 1 0 1 0 0 0. = binary form of 168 (Again, each 1 holds value of number below it.)
    128 64 32 16 8 4 2 1

    0 0 0 0 0 0 0 0. = 0 , Duh..
    128 64 32 16 8 4 2 1

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

    So, 11000000.10101000.00000000.00000001 is the Binary octet breakdown of 192.168.0.1 . Believe it or not this is actually important. Now, let’s delve into the realm of Subnet masks. The subnet mask is what will actually do all of the work of subnetting (read again, subnet mask.) The subnet mask of an ip address is what tells the computer or router or whatever, which part of your ip address belongs to your network and which part belongs to the hosts. Thus, a subnet mask of 255.255.255.0 tells your computer that the first three quads of your ip address belong to the network, and so all of your hosts will be referenced with the last quad in the ip address. This gives us with a standard subnet mask of 255.255.255.0, a possibility of 253 hosts in our network. WHAT? Even though I did fail algebra II, my math does make sense. You are required to have a base network address and a broadcast address for every subnet. So, with our standard subnet mask and our default ip address in our example, our network address is 192.168.0.0, our broadcast address is 192.168.0.255, which leaves us 192.168.0.1-254 for our hosts.
    Great! Now the basics are out of the way. Let’s move on to the important stuff. How we subnet an ip range depends first on how large your assigned ip range is to begin with. If you are running a private network going through One static Ip address then your range is: 192.168.xxx.xxx . So there is really no reason to subnet UNLESS you want to cut down on traffic and segment your lan by whatever reason you feel is good enough to undertake this task. Lets assume an ip address of 128.16.8.0 as a base. This is obviously a simplified example, but enough so to get the point of the exercise. Broken down into dotted octet notation 128.16.8.0 is:
    10000000.00010000.00001000.00000000
    Now, the first step in subnetting, is planning. How many hosts do you want per mask? Is there a chance that you may be expanding any or all of these subnets in the future? These are all things that HAVE to be taken into consideration BEFORE you get everything setup. The reason is this, the amount of hosts you decide upon directly affects all the following steps. Say you want to have 20 hosts available per subnet. This means that you will need a minimum of 22 hosts (Remember, network address and broadcast have to be taken into account also.) Lets zoom in on the last octet of our ip address.

    0 0 0 0 0 0 0 0 Remember this from above?
    128 64 32 16 8 4 2 1

    So, if we want at least 22 hosts on each of our subnets then we are going to need the last 5 bits in our octet quad. This will give us a total available of 16+8+4+2+1 or 31 possible hosts or 29 if you don’t count the network address and broadcast address. This leaves the first three bits of the octet for Network addressing (again, refer to the top on how ips work.) This makes our Subnet Mask for our ENTIRE network 255.255.255.224. How did I come up with this? The positional notation values for the first three bits of our final octet, when added together, equal 224.

    {Network bits}{ Host bits}

    {128 64 32 }{ 16 8 4 2 1}


    0 0 0 0 0 0 0 0 Network address for this subnet
    0 0 0 0 1 IP Range of 128.16.8.0-31
    0 0 0 1 0
    0 0 0 1 1
    …….
    1 1 1 1 1 Broadcast address for this subnet

    0 0 1 0 0 0 0 0 Network address for this subnet
    0 0 0 0 1 IP Range of 128.16.8.32-63
    0 0 0 1 0
    0 0 0 1 1
    …….
    1 1 1 1 1 Broadcast address for this subnet

    0 1 0 0 0 0 0 0 Network address for this subnet
    0 0 0 0 1 IP Range of 128.16.8.64-95
    0 0 0 1 0
    0 0 0 1 1
    …….
    1 1 1 1 1 Broadcast address for this subnet

    ………….
    ………….

    1 1 1 0 0 0 0 0 Network address for this subnet
    0 0 0 0 1 IP Range of 128.16.8.224-255
    0 0 0 1 0
    0 0 0 1 1
    …….
    1 1 1 1 1 Broadcast address for this subnet


    Get the picture so far? So lets see where we stand now. We have our ip address of 128.16.8.0. Now lets look at the subnet mask as we figured out above. For our first subnet, we use our subnet mask of 255.255.255.224. This gives us hosts from 128.16.8.1 to 30 with 128.16.8.0 for network address and 128.16.8.31 as broadcast. Our next subnet would be 128.16.8.32 with the same 31 hosts counting broadcast and network. The subnet following that would have anip range of 128.16.8.64-95. The next would be 128.16.8.96-127, then 128-159, then 160-191, 192-223, and finally 224-255.
    This is a very simplified example without a lot of why this happens. Here is an attempt on my part to explain how this works. Your Ip address and your subnet mask is bitwise “AND”ed together (read boolean algebrea). “0”s hide the number, while “1”s let it show through. The resulting binary number is your network address that falls out of the addition. Example:

    11000000.10101000.00000000.00000001 Network address (192.168.0.1)
    11111111.11111111.11111111.11100000 + Subnet Mask (255.255.255.224)
    11000000.10101000.00000000.000 Network address (192.168.0.0 in this case)

    This means anything to the right of the 4th bit in the final octet is a host address. This also means that the first three bits in the final octets are network address’. So, as above, our first subnet would be 192.168.0.0-31. After that we would have to set the third bit from the left in the final octet, which changes the network address and results in our second subnet. Example:

    11000000.10101000.00000000.00100000 Network address (192.168.0.32)
    11111111.11111111.11111111.11100000 + Subnet Mask (255.255.255.224)
    11000000.10101000.00000000.001 Network address (192.168.0.32 in this case)

    which breaks us down into the subnet ip range of 192.168.0.32-63. Catching on yet? Here is another quick example. Our next subnet would be what?

    11000000.10101000.00000000.01000000 Network address (192.168.0.64)
    11111111.11111111.11111111.11100000 + Subnet Mask (255.255.255.224)
    11000000.10101000.00000000.010 Network address (192.168.0.64 in this case)

    leaving 192.168.0.64-95 as our subnet ip ranges. Hope I didn’t confuse you to terribly, but this is the main gist of Subnetting a network. Feel free to contact me with any questions, I might not be able to answer them off the top of my head, but I will do my best.
    Bolt actions speak louder than words.

  2. #2
    PHP/PostgreSQL guy
    Join Date
    Dec 2001
    Posts
    1,164

    Thumbs up

    Very good post dude. Networking on that level has always confused me as most of my network work is involved on the system level and not relating too much with figuring out subnets and such. We need more tutorials and this is a good one as is MsMittens tutorial on binary/hex/decimal.
    We the willing, led by the unknowing, have been doing the impossible for the ungrateful. We have done so much with so little for so long that we are now qualified to do just about anything with almost nothing.

  3. #3
    Senior Member
    Join Date
    Nov 2001
    Posts
    157

    thanks

    Ip addressing is a critical topic to spend time on. That's the whole deal! To get good with it just takes time and practise and playing with the numbers and conversions. There are, after all on 256 numbers one has to memorize the binary conversion for if they want to go the memorization route and be quick at it... but as far as subnetting goes there is only 7 and those are the really critical ones to be able to do at the drop of a hat.

    0 masked bits = the network number (only used w/VLSM)
    1 masked bits = 128
    2 masked bits = 192
    3 masked bits = 224
    4 masked bits = 240
    5 masked bits = 248
    6 masked bits = 252
    7 masked bits = 254
    8 masked bits = 255 -> the broadcast addy for the network

    subnet masks will have one of those numbers as the last octet



    Thanks for your post MtnMan....this is the kind of topic that people need to have presented to them many times in many different ways. It's the "hard" that makes it great! If it looked too easy then everyone could understand it and those of us who've spent time with it would be less mysterious to the sales and marketing types.

    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-==-=
    Noah built the ark BEFORE it rained.


    http://ld.net/?rn
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-==-=

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •