IP Addressing

 

Classes     Binary Start     Binary End        First Octet            Most Significant Bits                Special Note

Class A        00000000         01111111             1-126                                  0                                   Assignable

Class B        10000000         10111111           128-191                              10                                   Assignable

Class C        11000000         11011111           192-223                            110                                   Assignable

Class D        11100000         11101111            224-239                         1110                                   Multicast

Class E        11110000         11110111            240-247                        11110                                   InterNIC

 

Classes      Total Number of Network per Class (Assignable only)                                               Network

Class A        01111111.00000000.00000000.00000000 = 2 to the 7th power   =           126              Net.H.H.H

Class B        10111111.11111111.00000000.00000000 = 2 to the 14th power =      16,384             Net.Net.H.H

Class C        11011111.11111111.11111111.00000000 = 2 to the 21st power = 2,097,152            Net.Net.Net.H

 

Classes      Total Number of Host per Class (Assignable only)                                                          Host

Class A        00000000.11111111.11111111.11111111 = 2 to the 24th power –2 = 16,777,214     x.255.255.255 

Class B        00000000.00000000.11111111.11111111 = 2 to the 16th power – 2 =       65,534        x.y.255.255

Class C        00000000.00000000.00000000.11111111 = 2 to the 8th power – 2  =             254           x.y.z.255

 

Reserved Address Space = *RFC 1166 and 1918 = Private (Internal use only) address space

Netblock                                    Special Use                                Reference

10.x.x.x                                       Private                                         RFC 1918

127.x.x.x                                     Loopback                                    Diagnostics

172.(16-31).x.x                           Private                                         RFC 1918

192.0.0.x                                     Reserved                                     JBP

192.0.1.x                                     Backbone-Test-C                        RH6

192.0.2.x                                     Internet-Test-C                            JBP

192.0.(3-255).x                           Unassigned                                  NIC

192.1.(0-1).x                               Backbone Local Nets                  SGC

192.1.2.x                                     Backbone Fiber Nets                   SGC

192.1.3.x                                     Backbone Apollo Nets                 SGC

192.168.x.x                                 Private                                          RFC 1918

 

Subnetting

 

Think of subnetting as stealing from Peter to give to Paul.

You have a maximum number of bits (determined by class) to play with and if you overlap, it won’t work.

Steal host bits moving from Left to Right to acquire more Subnets.

Steal subnet bits moving from Right to Left to acquire more Hosts per sub.

 

Left-to-Right: Use Network n bits (2n) – 2 = x to get x total number of Subnets per stolen Host bit.

Example:        Steal 3 Host bits out of total 8 for Subnets on a Class C (see below)

Answer:          This means you can have (23) – 2 = (8-2) = 6 Subnets from this 3-bit Mask.

Note:              The leading 3 bits (11100000) = 128 + 64 + 32 = 224 Decimal Subnet Mask.

 

Right-to-Left: Use remaining Host h bits (2h) – 2 = x to get total x number of Hosts per Subnet.

Example:        There are 5 Host bits remaining out of 8 after using 3 for Subnets on Class C (see above)

Answer:          This means you can have (25) – 2 = (32-2) = 30 Hosts per Subnet.

Note:              The Subnet Mask answer would be either slash notation /27 or decimal 255.255.255.224 you are

                        using a Class C address, with 3 bits of subnetting, and 5 host bits remaining.

 

 

Class A = Total 24 bits to use for subnetting

Bits    Subnets       Subnets             Hosts Per       Hosts Per          Slash            Masks                    Sub

 (n)       (2n-2)       (Decimal)          (2(24-n)-2)       (Decimal)      (Notation)      (Decimal)                (Slice)

1           (21)-2        2-2=0                (223)-2              8,388,606           /9            255.128.0.0              Subnet 0

2           (22)-2        4-2=2                (222)-2              4,194,302           /10          255.192.0.0              Sub 1/7

3           (23)-2        8-2=6                (221)-2              2,097,150           /11          255.224.0.0              Sub 2/7

4           (24)-2        16-2=14            (220)-2              1,048,574           /12          255.240.0.0              Sub 3/7

5           (25)-2        32-2=30            (219)-2                 524,286           /13          255.248.0.0              Sub 4/7

6           (26)-2        64-2=62            (218)-2                 262,142           /14          255.252.0.0              Sub 5/7

7*         (27)-2        128-2=126        (217)-2                 131,070           /15          255.254.0.0              Sub 6/7

8*         (28)-2        256-2=254        (216)-2                   65,534           /16          255.255.0.0              Sub 7/7

* = 7 subs valid for Class A or B in 1st octet. Class C has only 5 valid – the last 2 are binary all 1.

 

Class B = Total 16 bits to use for subnetting

Bits    Subnets       Subnets             Hosts Per       Hosts Per          Slash             Masks                    Sub

 (n)       (2n-2)       (Decimal)          (2(16-n)-2)       (Decimal)      (Notation)       (Decimal)                (Slice)

1           (21)-2        2-2=0                (215)-2              32,766                /17          255.255.128.0           Subnet 0

2           (22)-2        4-2=2                (214)-2              16,382                /18          255.255.192.0           Sub 1/7

3           (23)-2        8-2=6                (213)-2                8,190                /19          255.255.224.0           Sub 2/7

4           (24)-2        16-2=14            (212)-2                4,094                /20          255.255.240.0           Sub 3/7

5           (25)-2        32-2=30            (211)-2                2,046                /21          255.255.248.0           Sub 4/7

6           (26)-2        64-2=62            (210)-2                1,022                /22          255.255.252.0           Sub 5/7

7*         (27)-2        128-2=126        (29)-2                     510                /23          255.255.254.0           Sub 6/7

8*         (28)-2        256-2=254        (28)-2                     254                /24          255.255.255.0           Sub 7/7

* = 7 subs valid for Class A or B in 1st octet. Class C has only 5 valid – the last 2 are binary all 1.

 

Class C = Total 8 bits to use for subnetting

Bits    Subnets       Subnets             Hosts Per       Hosts Per          Slash             Masks                    Sub

 (n)       (2n-2)       (Decimal)          (2(8-n)-2)       (Decimal)      (Notation)       (Decimal)                (Slice)

1           (21)-2        2-2=0                (27)-2                      0                   /25          255.255.255.128        Subnet 0

2           (22)-2        4-2=2                (26)-2                    62                   /26          255.255.255.192        Sub 1/7

3           (23)-2        8-2=6                (25)-2                    30                   /27          255.255.255.224        Sub 2/7

4           (24)-2        16-2=14            (24)-2                    14                   /28          255.255.255.240        Sub 3/7

5           (25)-2        32-2=30            (23)-2                      6                   /29          255.255.255.248        Sub 4/7

6           (26)-2        64-2=62            (22)-2                      2                   /30          255.255.255.252        Sub 5/7

 

Real World Walkthrough

 

Given:       You have address 132.7.0.0. You need 5 equal-size Subnets with 1,500 Hosts per Sub.

Objective: Compute the following information, in the following order.

  1. Find the number of Host bits to steal to get the required number of Subs.
  2. Find the number of Hosts per Subnet you will get.
  3. Find the decimal value of the new subnet mask.
  4. Find the Incremental Value of the Subnets.
  5. Find the First Host, Broadcast, and Last Host of each Subnet.

 

A. Using the powers of 2, first see how many bits you need to steal from Hosts to acquire 5 subnets.

  1. First octet is 132, which is in the range of 128-191, so this is a Class B. Each octet has 8 bits.
  2. Class B address have the first 2 octets (16 bits) locked in, so you can’t touch those. There are 2 octets (16 bits) remaining.
  3. Going from Left to Right, start gobbling up Host bits. If you hit 16, you are out of bounds, and it won’t work.
  4. Steal 1 bit? (21) – 2 = 0, no that never work.
  5. Steal 2 bits? (22) –2 = 2, not enough subs yet, keep going.
  6. Steal 3 bits? (23) – 2 = 6, hey we found it, only need 3 bits for 6 subs (leaves only 1 sub for future expansion!).
  7. Write those first 3 bits into your Weighted Values Chart.

 

                                                                  Weighted Values

            Most Significant Bit                                                                                   Least Significant Bit

Subs    128               64               32                 16                   8                    4                2               1    Hosts

              1                  1                 1                   0                    0                   0                0                0

 

B. Using powers of 2, next see how many Host bits you have remaining.

  1. Going from Right to Left, count the remaining bits. This will be how many Hosts per Sub you get.
  2. Since we know we had 16 host bits total for our Class B, and we stole 3 bits, that leave us with 13 bits for Hosts.
  3. Compute (213) – 2 = 8,190 Hosts per sub. Wow!
  4. Since this is so many more Hosts than we need, consider stealing extra Host bits to create extra Subs for future expansion!!

 

C. Using the Weighted Values Chart, find out what the decimal Subnet Mask will be.

  1. Simply add 128 + 64 + 32 = 224 from the chart above.
  2. Since this was a Class B and the first 2 octets are reserved, the default mask is 255.255.0.0.
  3. We stole the first 3 bits out of the 3rd octet, so that is the only octet we really cared about.
  4. The new decimal mask is 255.255.224.0, or shorthand notation /19 (8 + 8 + 3 = 19).

 

D. Using the Decimal Mask, or the last Network Bit’s Weighted Value, find the Incremental Value.

  1. Option 1: Take the new Subnet Mask (the octet found in step C1 above) and subtract from 256.
  2. Option 2: Look at the Weighted Values Chart and find the last bit flipped to 1 going Left to Right.
  3. Either way, we now have the Incremental Value of 32.
  4. This means Valid Subnetwork Number 1 is going to be 32, and each valid subnet will increase by 32, until the Subnet Mask is hit.

 

E. Using the Incremental Value, count up and find the First Host IP, Broadcast for that Sub, and the Last Host IP.

  1. Start at the Incremental Value, which is 32.
  2. Add up the next Incremental Value, which is 32 + 32 = 64.
  3. Take one LESS than the NEXT Incremental Value (64 – 1 = 63), and that is the PREVIOUS subnets Broadcast (for Sub 32).
  4. Add one to the current Incremental Value (32 + 1 = 33), that is your First Host (for Sub 32).
  5. Subtract one from the current subnets Broadcast (63 – 1 = 62), that is your Last Host (for Sub 32).
  6. See the chart below for details.

 

Notes: There are (23) – 2 = 6 subnets created. The – 2 is important, because you cannot use all 0 or all 1 subnets. The special all 0 address is the network ID for that subnet, and will be used by a router in its routing table. The special all 1 address is the network broadcast for all subnets on this wire.

 

Range 0 x 32                        0 Subnet #0                Subnet Zero should be considered invalid.

Range 1 x 32                      32 Subnet #1                Increment 32 = Subnet ID used by Routing Table

                                                                               First Host = 33

                                                                               Last Host = 62

                                                                               Subnet Broadcast = 63

Range 2 x 32                      64 Subnet #2                Increment 64 = Subnet ID used by Routing Table

                                                                               First Host = 65

                                                                               Last Host = 94

                                                                               Subnet Broadcast = 95

Range 3 x 32                      96 Subnet #3                Increment 96 = Subnet ID used by Routing Table

                                                                               First Host = 97

                                                                               Last Host = 126

                                                                               Subnet Broadcast = 127

Range 4 x 32                    128 Subnet #4                Increment 128 = Subnet ID used by Routing Table

                                                                               First Host = 129

                                                                               Last Host = 158

                                                                               Subnet Broadcast = 159

Range 5 x 32                    160 Subnet #5                Increment 160 = Subnet ID used by Routing Table

                                                                               First Host = 161

                                                                               Last Host = 190

                                                                               Subnet Broadcast = 191

Range 6 x 32                    192 Subnet #6                Increment 192 = Subnet ID used by Routing Table

                                                                               First Host = 193

                                                                               Last Host = 222

                                                                               Subnet Broadcast = 223

Range 7 x 32                    224 Subnet #7                Broadcast Reserved.

 

1
Summary :
IP Address Classes:
Class A --> 1 ----> 126.0.0.0
126 Networks / 16,777,214 Hosts
Class B --> 128 --> 191.x.0.0
16,384 Networks / 65,534 Hosts
Class C --> 192 --> 223.x.x.0
2,097,152 Networks / 254 Hosts
Private Networks:
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255