Options

Subnetting IPv4 Address

RoguetadhgRoguetadhg Member Posts: 2,489 ■■■■■■■■□□
Pardon the dust. This is a work in progress, I just don't feel like loosing the progress! My signature will say the last time it's been updated. When completed, this part will disappear. Poof!



Subnetting. We love to hate it. You're given a number and you're expected to do it right and do it quick. Seeing as there's over 300 threads that include subnetting - upto April 2011.

This is my own contribution to teaching subnetting. I've been through a lot of

Calculators:
While studying for your Cisco exams, or CompTIA Network+, you'll need to know how to subnet. Using calculators to do the work will not help you. I'm stressing that you use your noggin and work the problems out on your own. Use the calculators to check your work, not to do the work for you.


0. Introduction:
0a. Classes
0b. Private/Reserved Addresses
0c. Terms and Definitions

Subnetting:
1a. Converting: Dotted Decimal to Binary (Inc: Reversal)
1b. Converting: Dotted Decimal to Prefix (Inc: Reversal)
1c. Find: Subnet
1d. Find: Broadcast
1e. Find: Range
1f. Find: Number of Subnet (Inc: Subnet-Zero)
1g. Find: Hosts per subnet
1h. Speed: How fast should you be?

Advanced Subnetting:
2a. Find: Wild-Card Masks
2b. VLSM - Variable Length SubnetMasks
2c. Summarization

Other:
3. Shortcuts.
4. Other Sources of Subnetting Lessons
5. Practicing
5. Calculators

0a. Classes:
There are 5 IPv4 Classes:
Class A: 1.0.0.0 - 126.0.0.0
Class B: 128.0.0.0 - 191.0.0.0
Class C: 192.0.0.0 - 223.0.0.0

Class D*: 224.0.0.0 - 239.0.0.0
Class E*: 240.0.0.0 - 255.0.0.0
* = Ignore for subnetting purposes.

Each class of addresses have an absolute minimal, "classful" subnet mask: All of the 1's work as "N" bits.
Class A: In Binary: 11111111.00000000.00000000.00000000 | 255.0.0.0 | 8 Bits
Class B: In Binary: 11111111.11111111.00000000.00000000 | 255.255.0.0 | 16 Bits
Class C: In Binary: 11111111.11111111.11111111.00000000 | 255.255.255.0 | 24 Bits

Class D*: No Subnet
Class E*: No Subnet
* = Ignore for subnetting purposes.

0b. Private/Reserved Addresses:
Class A: 10.0.0.0 - 10.255.255.255
Class B: 172.16.0.0 - 172.31.255.255
Class C: 192.254.0.0 - 192.254.255.255

Private IP Addresses used when DHCP Assignment is not available:
169.254.0.0 - 169.254.255.255

Loopback:
127.0.0.1


0b. Terms and Definitions:
Dotted Decimal:
Looks Like: 255.255.255.255.
What's it mean: Binary Bits into Base 10 numbers. Easier to read, and understand. Separated by dots.
Other Names: Dot-Decimal Notation. Quad-dotted notation.

Binary:
Looks Like: 00000000
What's it mean: Base 2 numbers. Each Zero and one represents a single bit; On or Off. One means On. Zero means Off.
Other Names: Binary Numeral System.

VLSM
Looks like: 255.255.255.192
What's it mean: Allows for more precise subnetting based on required hosts and subnets. Essentially, subnetting a subnet.
Other Names: Supernetting

Prefix
Looks like: /10
What's it mean: Counts the number of bits within a mask. IPv4 use 32 Bits, IPv6 use 128 Bits. Often used interchangably with subnet masks.
Example: 255.255.128.0 (Subnet) = /17 (prefix)
Other Names: CIDR Notation

1a. Converting: Dotted Decimal to Binary
You will be subtracting numbers, and marking which ones you subtracted with a "1". Heck, you can even put squiggle marks.

Example Problem (1): 192.0.0.0 (Subnet)

You'll need:
[ 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 ]

Step 1: What's the largest number you can subtract by?
Subtract 255 by the largest number possible (128).
192 - 128 = 64. Place a 1 above "128" in the table.

Step 2: Subtract the remaining number (64) by the next number (64)
64 - 64 = 0. Place a 1 above "64" in the table.

Step 3: Since there's no more numbers to subtract, put 0 above the other numbers in the table (32, 16, 8, 4, 2, 1).

Step 4: Put 0s at the places where there's no 0s:
You'll get 2x 1's and 6x 0's: 11000000

Example Problem (2): 173

Table: [ 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 ]

Step 1: What's the largest number you can subtract the number (173) by? 128
173 - 128 = 45. Mark 128 in the table with a squiggle.

Step 2: What's the largest number you can subtract the remainder (45) by? 32
45 - 32 = 13. Mark 32 in the table with a squiggle.

Step 3: What's the largest number you can subtract the remainder (13) by? 8
13 - 8 = 5. Mark 8 with an X.

Step 4: What's the largest number you can subtract the remainder (5) by? 4
5 - 4 = 1. Mark 4 with a... one! (Thought I was going to say X, Did you?)

Step 5: What's the largest number you can subtract the remainder (1) by? 1
1 - 1 = 0. Mark 1 with an X!

Step 6: Make sure you go back to the numbers you didn't mark, with a Zeros (0). If you're like me, you'll forget later!

You should have something that looks like this:
~0~0X10X
...I think it'll look neater with 1's instead of squiggles and X's though
10101101
Much better. That's the answer to 173. And that's how you convert it into binary.

/color][i][color=darkgreen]See Shortcuts[/color][/i][color=green


Binary into Dotted Decimal:
Step 1: Line up the given binary to the table.

Step 2: Add the numbers that are marked with a 1

Example Problem (1): 11101011
Trusty Table: [ 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 ]

Step 1: Line up the binary to the table. (I've marked the ones that line up in Bold)
[ 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 ]

Step 2: Add the numbers that line up with the binary (11101011).
128 + 64 + 32 + 8 + 2 + 1 = 235.

/color][i][color=darkgreen]See Shortcuts[/color][/i][color=green

1b. Converting: Dotted Decimal to Prefix
Take the number of bits in a shortcut, and counting them out with a slash before it!

Example Problem (1): 192.0.0.0 (Subnet)
Step 1: Convert to Binary (11000000.00000000.00000000.00000000)
Step 2: Count the number of bits. 2
Step 3: Put a slash before it. /2

1c. Find: Subnet
Example Problem (IP):217.74.31.8
Example Problem (SM):/28

Step 1: Convert any Prefix/CIDR notation into Dotted Decimal.
255.255.255.240
Why? It's optional, if you can use the prefix notation, that's fine.

Step 2: Discover the class of the IP Address (217.74.31.8 )
Class C.
Why? The class of IP Address will give you the absolute subnet number. These bits can not be used for Networks or Hosts.

Step 3: Based on Step 2, What is the classful (absolute) mask?
255.255.255.0

In Binary: 11111111.11111111.11111111.00000000

Step 4: Convert the rest of the given subnet mask into binary. Forget the classful part, you can't use them. I've marked it with red X's
X.X.X.11110000

Step 5: Look at the Right-most subnet bit. Refer to the conversion you made above. This is a very important bit for shortcuts.
X.X.X.11110000

This bit marks the first subnet.

Step 6: take the set of 8 bits that don't have all 1s or 0s, and place it along the table. Notice the location of the bit falls inline with the 16th number:
THE Table of Gods: [ 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 ]
X.X.X.11110000

Call this bit the "Range" bit. Place a line right after this bit, before the next 0. (0001|0000)

Take a glance back at the entire mask in binary reveals three sections: Network bits (Classful), Subnet, and Host bits (All bits to the right of the green line)
11111111.11111111.11111111.1111|0000

Step 7: Go back to the IP Address: 217.74.31.8
Concern yourself with the numbers that do not go with the Classful Subnet Mask. The numbers that are covered by the Classful Mask can not be changed.

Step 8: Convert the group of numbers you can work with into Binary: 217.74.31.8
Clobberin Time: [ 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 ]

Converted: 00001000

Step 9: Take the converted Subnet mask's range bit (0001|0000) and place it above the binary IP address (00001000)
(0001|0000)
(00001000)

Step 10: And (Not ADD), the vertical numbers together.
ANDing: A Quick and Dirty Lesson: 0 + 0 = 0, 1 + 0 = 0, 1 + 1 = 1, 0 + 1 = 0

0001|0000 = 16 (Subnet Mask Range Bit)
0000|1000 = 8 (From the IP address)


0000|0000 = 0


Subnet Number: 217.74.31.0


Speed:
These are the time limits that you should be able to exceed by the time you go for your test. How do you get better? Perfect Practice makes perfect.
5 Seconds - Convert Dotted Decimal to Prefix/CIDR notation.[255.255.128.0 to /17]
5 Seconds - Convert Prefix/CIDR notation to Dotted Decimal.[/17 to 255.255.128.0]
15 Seconds - Find: Subnet, Broadcast, Range. [10.0.128.0, 10.0.255.255, 10.0.128.0 - 10.0.255.255]
15 Seconds - Find: Number of subnets, Hosts per subnet. [512, 32768]
30 Seconds - Find mask that meet requirements that maximize subnets / hosts per subnet.





Subnet-Zero:
This is a topic that's often time not discussed. We forget about this one IOS command, but it can make a big difference:

As per: Cisco: http://www.cisco.com/en/US/docs/ios/12_3/ipaddr/command/reference/ip1_i2g.html#wp1081869:
Subnet-Zero is enabled by default in newer version. Assume for the exams, subnet-zero is enabled. The exam must state that subnet-zero is "Off" or "Disabled" otherwise.
ip subnet-zero = On. Enabled. Do not subtract 2.
no ip subnet-zero = Off. Disabled. Subtract 2 for subnets..

Explanation: (This is one of the better explanations I've found. I've edited it to make it a little more easy-swallowing.)
In the days before CIDR, if you had a set of subnets induced upon a base network address, then the first and last of those subnets were reserved. ip subnet-zero tells the router that those subnets are not reserved.

For example: if you were using subnets of a class C address (say, 192.168.12.0) induced by the subnet mask 255.255.255.192 (that's 64 addresses at a chunk). You would have four subnets generated: 1) 192.168.12.0-63 2) 192.168.12.64-127 3) 192.168.12.128-191 4) 192.168.12.192-255.
However, before CIDR you would not be allowed to use the first (192.168.12.0-63) or last (192.168.12.192-255). This leaves you with only two usable subnets (192.168.12.64-127 and 192.168.12.128-191).
Source: http://www.velocityreviews.com/forums/t35936-whats-the-ip-zero-subnet-command-for.html

The above example, there's 4 subnets. Using the command ip subnet-zero allows the use of the first and last subnets.

In short, without ip subnet-zero: The method you use to find the number of Valid hosts [(2^1)-2] would also be the same to find valid subnets [(2^1)-2]
In short, with ip subnet zero: The method you use to find the number of valid hosts [(2^1)-2] would be different to find the valid subnets (2^1).

Shorter still: No ip subnet-zero = No first and last subnet.



Shortcuts:
1. Subtracting wierd numbers.
An easier way of doing odd subtracting is by doing a smaller adding or subtracting first. Keeping a mental note, and then adding it or subtracting it from the final number.
Example: 91 - 64.
Step 1: Reduce/Increase the second number into a whole number: 64 (-4 = 60) or (+6 = 70). I'll subtract 4 to make 64 = 60.
Step 2: Subtract the new number: 91 - 60 = 31.
Step 3: Subtract the 4 from 31: 31 - 4 = 27.

Fun fact: It's called "Sutra".

2. Adding Binary
Look at the binary table: [ 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 ].
Can you see the groupings of numbers that make easy numbers when adding?

Let me show you:
[ 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 ]
Every other number creates a number that works with the number 5.
16 + 4 = 20, 128 + 32 = 170,...



How to subnet:
There's as many way to teach subnetting as there are stars in the sky. These, are just a sample:
Tech Exams: http://www.techexams.net/technotesnew/158-ipv4-subnetting-guide.html
Learn to Subnet: http://www.learntosubnet.com/
Microsoft: http://technet.microsoft.com/en-us/library/bb726997.aspx
TechRepublic: http://www.techrepublic.com/article/ip-subnetting-made-easy/6089187
Cisco: http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a00800a67f5.shtml
Tech Exams's Subnetting Test = http://www.techexams.net/practice-exams/take/cisco-subnetting

Perfect Practice makes Perfect:
Random Network, Broadcast, First, Last Addresses and Ranges = http://www.subnettingquestions.com/
VLSM Practice = http://www.subnetskillz.com/index.php?Pg=design-vlsm-network

Select the class of networks: = http://faculty.valleycollege.net/rpowell/jscript/subnet1.htm
Network, Broadcast and First,Last Usables = http://faculty.valleycollege.net/rpowell/jscript/subnet2.htm
CIDR Mask to Dotted Decimal = http://faculty.valleycollege.net/rpowell/jscript/subnet3.htm
Dotted Decimal to CIDR Mask = http://faculty.valleycollege.net/rpowell/jscript/subnet4.htm


Subnet Calculators:
Ip Subnet Calculator: http://www.subnet-calculator.com/
Web Tools: http://webtools.live2support.com/nt_subnet.php
VLSM: http://www.vlsm-calc.net/
In order to succeed, your desire for success should be greater than your fear of failure.
TE Threads: How to study for the CCENT/CCNA, Introduction to Cisco Exams

Comments

  • Options
    beginner_ccnabeginner_ccna Member Posts: 59 ■■□□□□□□□□
    great writeup, helping me nicely with subnetting icon_smile.gif
  • Options
    omidjahanpouromidjahanpour Registered Users Posts: 1 ■■■□□□□□□□
    Wow.. very well done! This helped me a lot. Thanks!
  • Options
    goldenlightgoldenlight Member Posts: 378 ■■□□□□□□□□
    NIce job Love the practice subnetting links. Especially the subnetskillz site
    The Only way to do great work is to love what you do. If you haven't found it keep looking. Don't settle - Steve Jobs
  • Options
    RoguetadhgRoguetadhg Member Posts: 2,489 ■■■■■■■■□□
    I forgot about this thread!
    In order to succeed, your desire for success should be greater than your fear of failure.
    TE Threads: How to study for the CCENT/CCNA, Introduction to Cisco Exams

  • Options
    vanquish23vanquish23 Member Posts: 224
    http://www.ietf.org/rfc/rfc1918.txt

    RFC 1918

    The Internet Assigned Numbers Authority (IANA) has reserved the
    following three blocks of the IP address space for private internets:

    10.0.0.0 - 10.255.255.255 (10/8 prefix)
    172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
    192.168.0.0 - 192.168.255.255 (192.168/16 prefix)

    You had listed in your write up 192.255.255.255, just wanted to make sure people did not get confused.
    He who SYNs is of the devil, for the devil has SYN'ed and ACK'ed from the beginning. For this purpose, that the ACK might destroy the works of the devil.
  • Options
    RoguetadhgRoguetadhg Member Posts: 2,489 ■■■■■■■■□□
    I can't edit the thread anylonger. So I just hope people can look down here. Rep though!
    In order to succeed, your desire for success should be greater than your fear of failure.
    TE Threads: How to study for the CCENT/CCNA, Introduction to Cisco Exams

  • Options
    excellentexcellent Registered Users Posts: 4 ■□□□□□□□□□
    hi,

    According to me, the ip search will displays the ip address in different formats like binary ,dotted-decimal.octal etc..It won't requires any type of conversion procedure. To do this search visit ip-details.com. After that, you can find the subnet method for ipv4 addresses easily.
Sign In or Register to comment.