IP Addressing & Subnetting
10:44 AM | Author: Siddhartha Ghosh
IP v4 addresses are made of four octets as below, where each x can either be 0 or 1
xxxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx

for. eg
01101010.11001101.11101000.11111000

As it’s very difficult to remember IP address in a binary form as above, we convert it to decimal for our convenience.

Like:-


So, 01101010.11001101.11101000.11111000 = 106.205.232.248

Classes of IP address:

There are 5 classes of Public IP addresses. Each class has it’s defined no. of higher order octet(s) set, that increments by 1 down the classes. These octets are fixed and don’t change.

Like:-
Class A has 1 higher order octet fixed, i.e. 00101100
Class B has 2 higher order octet fixed, i.e. 10110011
Class C has 3 higher order octet fixed, i.e. 11001010
Class D has 4 higher order octet fixed, i.e. 11101111
Class D has 4 higher order octet fixed, i.e. 11110101

With this representation you will always find that:-

Class A IP addresses start with 0 (Binary 00000000 = Decimal 0)
Class B IP addresses start with 128 (Binary 10000000 = Decimal 128)
Class C IP addresses start with 192 (Binary 11000000 = Decimal 192)
Class D IP addresses start with (Binary 11100000 = Decimal 224)
Class E IP addresses start with (Binary 11110000 = Decimal 240)

Further, you can notice that starting address of
Class A = 0
Class B = Class A + 128
Class C = Class B + 64
Class D = Class C + 32
Class E = Class D + 16

Class A – 0.0.0.0 to 127.255.255.255
Class B – 128.0.0.0 to 191.255.255.255
Class C – 192.0.0.0 to 223.255.255.255
Class D – 224.0.0.0 to 239.255.255.255
Class E – 240.0.0.0 to 254.255.255.255

In Class A, only first octet is used for Networks and other 3 octets are used for Hosts. Therefore, it’s used where larger no. of hosts are required.

In Class B, only first 2 octets are used for networks and other 2 for hosts.

In Class C, first 3 octets are used for networks and last one for hosts.

Networks and Hosts are not defined for Class D and E.

Therefore, representation is as below:

                        Network                Host
Class A         Xxxxxxxx xxxxxxxx . xxxxxxxx . xxxxxxxx
Class B         XXxxxxxx . xxxxxxxx xxxxxxxx . xxxxxxxx
Class C         XXXxxxxx . xxxxxxxx . xxxxxxxx xxxxxxxx

Formula for calculating no. of Networks = 2n-a ,where -------------------(i)

n is the no. of bits reserved for Networks.
a is the no. of leading bit (higher order bit) set.

For e.g:-

Class A has first octet reserved for Networks. One octet has 8 bits. Therefore, n = 8. Also, Class A has 1 higher order bit set, so a = 1
Now, putting the respective values in (i), we get
28-1=128
Note: There are two IP addresses that are reserved, 0.H.H.H and 127.H.H.H, therefore there are 126 valid networks possible.

Similarly,
Class B has 216-2=16,384
Class C has 232-3=2,097,152

Formula for calculating no. of Hosts = 2n-2 ,where -----------------------(ii)

n is the no. of bits reserved of Hosts

Note: We have subtracted 2 because one IP will be used to represent network and one for broadcast.
For e.g:-

Class A has last 3 octets reserved for Hosts. One octet has 8 bits. Therefore, n = 8x3 =24.
Now, putting the respective values in (ii), we get
224-2=16,777,214

Similarly,

Class B has 216-2=65,534
Class C has 28-2=254

However, we know that these amount of Networks and Hosts are not enough to cover the whole world and may get exhausted. Therefore, the concept of Private addressing came into picture.

It’s like a house with a telephone no. (Public address) assigned and each room has it’s own extension no. (Private address)

There are 3 Classes of Private IP addresses, they are as below:

Class A – 10.0.0.0 to 10.255.255.255
Class B – 172.16.0.0 to 172.31.255.255
Class C – 192.168.0.0 to 192.168.255.255

Once again octets are reserved for Network and Host part, class-wise as described above.

For Class A, there is one network (with default subnet) and it starts with 10, rest there are 224 Hosts.
For Class B, there are 16 networks (with default subnet), rest 216 are host.
For Class C, there are 254 networks, rest 28 are host.

Subnetting is dividing a network into sub-networks. For eg. A company has various departments like HR, Production, Accounts, Marketing, IT. Where IT department has sub departments like Hardware, Systems, Networking. And Production on other hand also has sub departments like QA, Testing, Coding etc.

As you can see, having one network for all the departments and sub departments doesn’t actually solve the purpose and may become ambiguous. Therefore, segregating the Networks department wise is very important.

Every Classes (Either Public or Private) has default Subnets.

Class A (Both Public and Private) has default subnet 255.0.0.0 or /8
Class B (Both Public and Private) has default subnet 255.255.0.0 or /16
Class C (Both Public and Private) has default subnet 255.255.255.0 or /24

Subnetting is done by borrowing the bits from the host part.

Valid subnets are:-
/4 = 22
/6 = 23-2
/14 = 24-2
/30 = 25-2
/62 = 26-2
/126 = 27-2

Now say, we are told to divide a network 172.16.0.0 /16 (10101100.00010000.HHHHHHHH.HHHHHHHH) into 9 subnetworks. How we will derive the subnet mask? Below is how we can do it.

  • Determine how many H bits you need to borrow to create nine valid subnets.2N - 2 > 9
    N comes out to be 4, so as to make it 14 which > 9. There no. of H bits = 8 –N = 4
    It can now be visualized as below:
    10101100.00010000.NNNNHHHH.HHHHHHHH



  • Now we know that there will be 14 subnets

    10101100.00010000.00000000.00000000 = 172.16.0.0 (invalid)
    10101100.00010000.00010000.00000000 = 172.16.16.0
    10101100.00010000.00100000.00000000 = 172.16.32.0
    10101100.00010000.00110000.00000000 = 172.16.48.0
    10101100.00010000.01000000.00000000 = 172.16.64.0
    10101100.00010000.01010000.00000000 = 172.16.80.0
    10101100.00010000.01100000.00000000 = 172.16.96.0
    10101100.00010000.01110000.00000000 = 172.16.112.0
    10101100.00010000.10000000.00000000 = 172.16.128.0
    10101100.00010000.10010000.00000000 = 172.16.144.0
    10101100.00010000.10100000.00000000 = 172.16.160.0
    10101100.00010000.10110000.00000000 = 172.16.176.0
    10101100.00010000.11000000.00000000 = 172.16.192.0
    10101100.00010000.11010000.00000000 = 172.16.208.0
    10101100.00010000.11100000.00000000 = 172.16.224.0
    10101100.00010000.11110000.00000000 = 172.16.240.0 (invalid)



  • Finish IP plan table.




  • The default subnet mask for a Class B network is as follows:
    Decimal Binary
    255.255.0.0 11111111.11111111.00000000.00000000

    1 = Network or subnetwork bit
    0 = Host bit

    You borrowed 4 bits; therefore, the new subnet mask is the following:
    11111111.11111111.11110000.00000000 255.255.240.0

    The Enhanced Bob Maneuver for Subnetting:


  • On the bottom line (Number of Valid Subnets), move from right to left and find the closest number that is bigger than or equal to what you need:
    Nine subnets move to 14.



  • From that number (14), move up to the line called Bit Place.
    Above 14 is bit place 4.



  • The dark line is called the high-order line. If you cross the line, you have to reverse direction.
    You were moving right to left; now you have to move from left to right.



  • Go to the line called Target Number. Counting from the left, move over the number of spaces that the bit place number tells you.
    Starting on 128, moving 4 places takes you to 16.



  • This target number is what you need to count by, starting at 0, and going until you hit 255 or greater. Stop before you get to 256:

    0
    16
    32
    48
    64
    80
    96
    112
    128
    144
    160
    176
    192
    208
    224
    240
    256Stoptoo far!



  • Go back to the Enhanced Bob Maneuver chart and look above your target number to the top line. The number above your target number is your subnet mask.

    Above 16 is 240. Because you started with a Class C network, the new subnet mask is 255.255.255.240.
  • This entry was posted on 10:44 AM and is filed under . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

    0 comments: