Wednesday, May 19, 2010

How to subnet. Pizza style

So there's a couple of things you have to remember about subnetting.  Ultimately, you are subdividing a network block of addresses into smaller pieces.  This division is done by adding bits of subnet onto the default mask for the subnet.  A class A address starts with a /8 or 255.0.0.0 mask.  A class B starts with /16 or 255.255.0.0 mask.  A class C starts with a /24 or 255.255.255.0 mask.

If you use a class C as an example it has 256(zero through 255) addresses though only 254 are usable because we reserve the first address "0" and the last address "255" for "network" and "directed broadcast" respectively.  As it turns out we reserve the same (first and last) for all of our network or subnet blocks.


Okay so if you have 256 addresses and you add 1 bit of subnetting to a /24 (255.255.255.0) mask you  get a /25 (255.255.255.128)  what this actually means is that you've divided your block in half.  Two pieces with 128 addresses each.  1 bit of subnetting is 2 ^1(to the power of 1) which equals 2. It's pretty much like slicing up pizza.



Guess what happens when you move add 2 bits to a class C default mask to make /26 (255.255.255.192).  4 blocks of 64.  If we use the class C of 192.168.1.0/24 as the network we divide, the first subnet address is 192.168.1.0/26.  The second block is192.168.1.64/26. The third is 192.168.1.128/64 and the fourth is 192.168.1.192/26.

To see more pie charts click Here



IP subnetting

Find network address and directed broadcast address

ex. 204.30.117.83/29

1) Write down a binary number chart. 128-64-32-16-8-4-2-1

2) Determine what class A,B,C your address belows to.
 ex. class c

3) Determine the number of subnet bits that have been added.
 ex. added 5 bits to make default mask of /24 into /29

This adds 5 bits of additional subnetting

4) Count out 29 bits and find the binary value it falls on.
ex.

1               1               1               1          
2 6 3 1         2 6 3 1         2 6 3 1         2 6 3 1      
8 4 2 6 8 4 2 1 8 4 2 6 8 4 2 1 8 4 2 6 8 4 2 1 8 4 2 6 8 4 2 1
---------------------------------------------------------------
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0
                                                        ^
                                                        29th bit
the value is 8

Note: this means that the original class C block which contains 256 possible address instances is divided into 8 address chunks





















5)  Count your subnets by bitvalue (ex. 8) starting from 0.  Look for the block of addresses that 204.30.117.83 fits into.
ex.
204.30.117.0/29
204.30.117.8/29
204.30.117.16/29
204.30.117.24/29
204.30.117.32/29
204.30.117.40/29
204.30.117.48/29
204.30.117.56/29
204.30.117.64/29
204.30.117.72/29
204.30.117.80/29 <-- address in this block
204.30.117.88/29
204.30.117.96/29
...
  
6) Write down info.
Remember the first address in the block is the reserved network address and the last address is the reserved directed broadcast.

Network 204.30.117.80/29
Broadcast is one less than the next block 204.30.117.88/29
Broadcast 204.30.117.87/29
Vaild IP is between those numbers .81 -.86







____________________________________________
The official way everyone is taught

____________________________________________

Old School Subneting 



Example 1
Example 2
ip address
subnetmask
10  .0.0.1   
255.0.0.0   
204. 30 .117.33
255.255.255.224
Step 1:
Convert IP address and Subnet mask to binary
            10.             0.              0.              1
00001010.00000000.00000000.00000001

         255.              0.              0.              0
11111111.00000000.00000000.00000000
         204.           30.           117.            33
11001100.00011110.01110101.00100001

         255.          255.          255.          224
11111111.11111111.11111111.11100000
Step2:
Draw line at end of 1’s on subnet mask to mask ip address and identify net and host
network                host

00001010.00000000.00000000.00000001

11111111.00000000.00000000.00000000
             network                                host

11001100.00011110.01110101.00100001

11111111.11111111.11111111.11100000
Step3: Network
Zero out host bits to find network address
network                host
               .00000000.00000000.00000000
00001010.00000000.00000000.00000001

11111111.00000000.00000000.00000000
network                                             host
                                                        .00000
11001100.00011110.01110101.00100001

11111111.11111111.11111111.11100000
Step3a: Network
Convert ip address from binary back to decimal

            10.             0.              0.              0
00001010.00000000.00000000.00000000

          204.           30.          117.            32
11001100.00011110.01110101.00100000
Step4: Broadcast
Replace host bits with 1’s to find directed broadcast
network                host
                .00000000.00000000.00000000
00001010.00000000.00000000.00000001
                .11111111.11111111.11111111
11111111.00000000.00000000.00000000
network                                             host
                                                        .00000
11001100.00011110.01110101.00100001
                                                        .11111
11111111.11111111.11111111.11100000
Step4a: Broadcast
Convert Subnet mask from binary back to decimal

           10.          255.          255.          255
00001010.11111111.11111111.11111111

          204.           30.          117.            63
11001100.00011110.01110101.00111111
Step5:     Range
To find usable range of ip addresses add 1 to network and subtract 1 from directed broadcast
      Network                  Broadcast

      10.0.0.0              10.255.255.255
             + 1                                   - 1
      10.0.0.1     -        10.255.255.254 
      Network                    Broadcast

     204.30.117.32          204.30.117.63
                       +1                            - 1
     204.30.117.33    -     204.30.117.62


No comments:

The Network