Monday, November 13, 2017

Classful Addressing

 In Classful Addressing System, IP Addresses are organized into following 5 classes-

 

 

  1. Class A
  2. Class B
  3. Class C
  4. Class D
  5. Class E

 

1. Class A-

 

If the 32 bit binary address starts with a bit 0, then IP Address belongs to class A.

 

In class A IP Address,

  • The first 8 bits are used for the Network ID.
  • The remaining 24 bits are used for the Host ID.

 

 

Total Number Of IP Addresses-

 

Total number of IP Addresses available in class A

= Numbers possible due to remaining available 31 bits

= 231

 

Total Number Of Networks-

 

Total number of networks available in class A

= Numbers possible due to remaining available 7 bits in the Net ID – 2

= 27 – 2

= 126

(The reason of subtracting 2 is explained later.)

 

Total Number Of Hosts-

 

Total number of hosts that can be configured in class A

= Numbers possible due to available 24 bits in the Host ID – 2

= 224 – 2

(The reason of subtracting 2 is explained later.)

 

Range Of 1st Octet-

 

We have-

  • Minimum value of 1st octet = 00000000 = 0
  • Maximum value of 1st octet = 01111111 = 127

 

From here,

  • Range of 1st octet = [0, 127]
  • But 2 networks are reserved and unused.
  • So, Range of 1st octet = [1, 126]

 

Use-

 

  • Class A is used by organizations requiring very large size networks like NASA, Pentagon etc.

 

2. Class B-

 

If the 32 bit binary address starts with bits 10, then IP Address belongs to class B.

 

In class B IP Address,

  • The first 16 bits are used for the Network ID.
  • The remaining 16 bits are used for the Host ID.

 

 

Total Number Of IP Addresses-

 

Total number of IP Addresses available in class B

= Numbers possible due to remaining available 30 bits

= 230

 

Total Number Of Networks-

 

Total number of networks available in class B

= Numbers possible due to remaining available 14 bits in the Net ID

= 214

 

Total Number Of Hosts-

 

Total number of hosts that can be configured in class B

= Numbers possible due to available 16 bits in the Host ID – 2

= 216 – 2

 

Range Of 1st Octet-

 

We have-

  • Minimum value of 1st octet = 10000000 = 128
  • Maximum value of 1st octet = 10111111 = 191

 

So, Range of 1st octet = [128, 191]

 

Use-

 

  • Class B is used by organizations requiring medium size networks like IRCTC, banks etc.

 

3. Class C-

 

If the 32 bit binary address starts with bits 110, then IP Address belongs to class C.

 

In class C IP Address,

  • The first 24 bits are used for the Network ID.
  • The remaining 8 bits are used for the Host ID.

 

 

Total Number Of IP Addresses-

 

Total number of IP Addresses available in class C

= Numbers possible due to remaining available 29 bits

= 229

 

Total Number Of Networks-

 

Total number of networks available in class C

= Numbers possible due to remaining available 21 bits in the Net ID

= 221

 

Total Number Of Hosts-

 

Total number of hosts that can be configured in class C

= Numbers possible due to available 8 bits in the Host ID – 2

= 28 – 2

 

Range Of 1st Octet-

 

We have-

  • Minimum value of 1st octet = 11000000 = 192
  • Maximum value of 1st octet = 110111111 = 223

 

So, Range of 1st octet = [192, 223]

 

Use-

 

  • Class C is used by organizations requiring small to medium size networks.
  • For example- engineering colleges, small universities, small offices etc.

 

4. Class D-

 

If the 32 bit binary address starts with bits 1110, then IP Address belongs to class D.

 

  • Class D is not divided into Network ID and Host ID.

 

 

Total Number Of IP Addresses-

 

Total number of IP Addresses available in class D

= Numbers possible due to remaining available 28 bits

= 228

 

Range Of 1st Octet-

 

We have-

  • Minimum value of 1st octet = 11100000 = 224
  • Maximum value of 1st octet = 11101111 = 239

 

So, Range of 1st octet = [224, 239]

 

Use-

 

  • Class D is reserved for multicasting.
  • In multicasting, there is no need to extract host address from the IP Address.
  • This is because data is not destined for a particular host.

 

5. Class E-

 

If the 32 bit binary address starts with bits 1111, then IP Address belongs to class E.

 

  • Class E is not divided into Network ID and Host ID.

 

 

Total Number Of IP Addresses-

 

Total number of IP Addresses available in class E

= Numbers possible due to remaining available 28 bits

= 228

 

Range Of 1st Octet-

 

We have-

  • Minimum value of 1st octet = 11110000 = 240
  • Maximum value of 1st octet = 11111111 = 255

 

So, Range of 1st octet = [240, 255]

 

Use-

 

  • Class E is reserved for future or experimental purposes.

 

Classes of IP Address-

 

All the classes of IP Address are summarized in the following table-

 

Class of IP AddressTotal Number of IP Addresses 1st Octet Decimal RangeNumber of Networks availableHosts per networkDefault Subnet Mask
Class A2311 – 12627 – 2224 – 2255.0.0.0
Class B230128 – 191214216 – 2255.255.0.0
Class C229192 – 22322128 – 2255.255.255.0
Class D228224 – 239Not definedNot definedNot defined
Class E228240 – 254Not definedNot definedNot defined

Sunday, November 12, 2017

Subnetting in Networking

 In networking,

  • The process of dividing a single network into multiple sub networks is called as subnetting.
  • The sub networks so created are called as subnets.

 

Example-

 

Following diagram shows the subnetting of a big single network into 4 smaller subnets-

 

 

Advantages-

 

The two main advantages of subnetting a network are-

  • It improves the security.
  • The maintenance and administration of subnets is easy.

 

Subnet ID-

 

  • Each subnet has its unique network address known as its Subnet ID.
  • The subnet ID is created by borrowing some bits from the Host ID part of the IP Address.
  • The number of bits borrowed depends on the number of subnets created.

 

Types of Subnetting-

 

Subnetting of a network may be carried out in the following two ways-

 

 

  1. Fixed Length Subnetting
  2. Variable Length Subnetting

 

1. Fixed Length Subnetting-

 

Fixed length subnetting also called as classful subnetting divides the network into subnets where-

  • All the subnets are of same size.
  • All the subnets have equal number of hosts.
  • All the subnets have same subnet mask.

 

2. Variable Length Subnetting-

 

Variable length subnetting also called as classless subnetting divides the network into subnets where-

  • All the subnets are not of same size.
  • All the subnets do not have equal number of hosts.
  • All the subnets do not have same subnet mask.

 

Subnetting Examples-

 

Now, we shall discuss some examples of subnetting a network-

 

Example-01:

 

Consider-

  • We have a big single network having IP Address 200.1.2.0.
  • We want to do subnetting and divide this network into 2 subnets.

 

Clearly, the given network belongs to class C.

 

 

Also Read- Classes of IP Address

 

For creating two subnets and to represent their subnet IDs, we require 1 bit.

So,

  • We borrow one bit from the Host ID part.
  • After borrowing one bit, Host ID part remains with only 7 bits.

 

 

  • If borrowed bit = 0, then it represents the first subnet.
  • If borrowed bit = 1, then it represents the second subnet.

 

IP Address of the two subnets are-

  • 200.1.2.00000000 = 200.1.2.0
  • 200.1.2.10000000 = 200.1.2.128

 

 

For 1st Subnet-

 

  • IP Address of the subnet = 200.1.2.0
  • Total number of IP Addresses = 27 = 128
  • Total number of hosts that can be configured = 128 – 2 = 126
  • Range of IP Addresses = [200.1.2.00000000, 200.1.2.01111111] = [200.1.2.0, 200.1.2.127]
  • Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
  • Limited Broadcast Address = 255.255.255.255

 

For 2nd Subnet-

 

  • IP Address of the subnet = 200.1.2.128
  • Total number of IP Addresses = 27 = 128
  • Total number of hosts that can be configured = 128 – 2 = 126
  • Range of IP Addresses = [200.1.2.10000000, 200.1.2.11111111] = [200.1.2.128, 200.1.2.255]
  • Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
  • Limited Broadcast Address = 255.255.255.255

 

Example-02:

 

Consider-

  • We have a big single network having IP Address 200.1.2.0.
  • We want to do subnetting and divide this network into 4 subnets.

 

Clearly, the given network belongs to class C.

 

 

For creating four subnets and to represent their subnet IDs, we require 2 bits.

So,

  • We borrow two bits from the Host ID part.
  • After borrowing two bits, Host ID part remains with only 6 bits.

 

 

  • If borrowed bits = 00, then it represents the 1st subnet.
  • If borrowed bits = 01, then it represents the 2nd subnet.
  • If borrowed bits = 10, then it represents the 3rd subnet.
  • If borrowed bits = 11, then it represents the 4th subnet.

 

IP Address of the four subnets are-

  • 200.1.2.00000000 = 200.1.2.0
  • 200.1.2.01000000 = 200.1.2.64
  • 200.1.2.10000000 = 200.1.2.128
  • 200.1.2.11000000 = 200.1.2.192

 

 

For 1st Subnet-

 

  • IP Address of the subnet = 200.1.2.0
  • Total number of IP Addresses = 26 = 64
  • Total number of hosts that can be configured = 64 – 2 = 62
  • Range of IP Addresses = [200.1.2.00000000, 200.1.2.00111111] = [200.1.2.0, 200.1.2.63]
  • Direct Broadcast Address = 200.1.2.00111111 = 200.1.2.63
  • Limited Broadcast Address = 255.255.255.255

 

For 2nd Subnet-

 

  • IP Address of the subnet = 200.1.2.64
  • Total number of IP Addresses = 26 = 64
  • Total number of hosts that can be configured = 64 – 2 = 62
  • Range of IP Addresses = [200.1.2.01000000, 200.1.2.01111111] = [200.1.2.64, 200.1.2.127]
  • Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
  • Limited Broadcast Address = 255.255.255.255

 

For 3rd Subnet-

 

  • IP Address of the subnet = 200.1.2.128
  • Total number of IP Addresses = 26 = 64
  • Total number of hosts that can be configured = 64 – 2 = 62
  • Range of IP Addresses = [200.1.2.10000000, 200.1.2.10111111] = [200.1.2.128, 200.1.2.191]
  • Direct Broadcast Address = 200.1.2.10111111 = 200.1.2.191
  • Limited Broadcast Address = 255.255.255.255

 

For 4th Subnet-

 

  • IP Address of the subnet = 200.1.2.192
  • Total number of IP Addresses = 26 = 64
  • Total number of hosts that can be configured = 64 – 2 = 62
  • Range of IP Addresses = [200.1.2.11000000, 200.1.2.11111111] = [200.1.2.192, 200.1.2.255]
  • Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
  • Limited Broadcast Address = 255.255.255.255

 

Example-03:

 

Consider-

  • We have a big single network having IP Address 200.1.2.0.
  • We want to do subnetting and divide this network into 3 subnets.

 

Here, the subnetting will be performed in two steps-

  1. Dividing the given network into 2 subnets
  2. Dividing one of the subnets further into 2 subnets

 

Step-01: Dividing Given Network into 2 Subnets-

 

The subnetting will be performed exactly in the same way as performed in Example-01.

After subnetting, we have-

 

 

Step-02: Dividing One Subnet into 2 Subnets-

 

  • We perform the subnetting of one of the subnets further into 2 subnets.
  • Consider we want to do subnetting of the 2nd subnet having IP Address 200.1.2.128.

 

For creating two subnets and to represent their subnet IDs, we require 1 bit.

So,

  • We borrow one more bit from the Host ID part.
  • After borrowing one bit, Host ID part remains with only 6 bits.

 

 

  • If 2nd borrowed bit = 0, then it represents one subnet.
  • If 2nd borrowed bit = 1, then it represents the other subnet.

 

IP Address of the two subnets are-

  • 200.1.2.10000000 = 200.1.2.128
  • 200.1.2.11000000 = 200.1.2.192

 

 

Finally, the given single network is divided into 3 subnets having IP Address-

  • 200.1.2.0
  • 200.1.2.128
  • 200.1.2.192

 

For 1st Subnet-

 

  • IP Address of the subnet = 200.1.2.0
  • Total number of IP Addresses = 27 = 128
  • Total number of hosts that can be configured = 128 – 2 = 126
  • Range of IP Addresses = [200.1.2.00000000, 200.1.2.01111111] = [200.1.2.0, 200.1.2.127]
  • Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
  • Limited Broadcast Address = 255.255.255.255

 

For 2nd Subnet-

 

  • IP Address of the subnet = 200.1.2.128
  • Total number of IP Addresses = 26 = 64
  • Total number of hosts that can be configured = 64 – 2 = 62
  • Range of IP Addresses = [200.1.2.10000000, 200.1.2.10111111] = [200.1.2.128, 200.1.2.191]
  • Direct Broadcast Address = 200.1.2.10111111 = 200.1.2.191
  • Limited Broadcast Address = 255.255.255.255

 

For 3rd Subnet-

 

  • IP Address of the subnet = 200.1.2.192
  • Total number of IP Addresses = 26 = 64
  • Total number of hosts that can be configured = 64 – 2 = 62
  • Range of IP Addresses = [200.1.2.11000000, 200.1.2.11111111] = [200.1.2.192, 200.1.2.255]
  • Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
  • Limited Broadcast Address = 255.255.255.255

 

Disadvantages of Subnetting-

 

Point-01:

 

Subnetting leads to loss of IP Addresses.

 

During subnetting,

  • We have to face a loss of IP Addresses.
  • This is because two IP Addresses are wasted for each subnet.
  • One IP address is wasted for its network address.
  • Other IP Address is wasted for its direct broadcasting address.

 

Point-02:

 

Subnetting leads to complicated communication process.

 

After subnetting, the communication process becomes complex involving the following 4 steps-

  1. Identifying the network
  2. Identifying the sub network
  3. Identifying the host
  4. Identifying the process

 

PRACTICE PROBLEMS BASED ON SUBNETTING IN NETWORKING-

 

Problem-01:

 

Suppose a network with IP Address 192.16.0.0. is divided into 2 subnets, find number of hosts per subnet.

Also for the first subnet, find-

  1. Subnet Address
  2. First Host ID
  3. Last Host ID
  4. Broadcast Address

 

Solution-

 

  • Given IP Address belongs to class C.
  • So, 24 bits are reserved for the Net ID.
  • The given network is divided into 2 subnets.
  • So, 1 bit is borrowed from the host ID part for the subnet IDs.
  • Then, Number of bits remaining for the Host ID = 7.
  • Thus, Number of hosts per subnet = 27 = 128.

 

For 1st Subnet-

 

  • Subnet Address = First IP Address =  192.16.0.00000000 = 172.16.0.0
  • First Host ID = 192.16.0.00000001 = 192.16.0.1
  • Last Host ID = 192.16.0.01111110 = 192.16.0.126
  • Broadcast Address = Last IP Address = 192.16.0.01111111 = 172.16.0.127

 

Problem-02:

 

What is not true about subnetting?

  1. It is applied for a single network
  2. It is used to improve security
  3. Bits are borrowed from network portion
  4. Bits are borrowed from Host portion

 

Solution-

 

Clearly, Option (C) is correct.

 

Problem-03:

 

In a class B, network on the internet has a subnet mask of 255.255.240.0. What is the maximum number of hosts per subnet?

  1. 4096
  2. 4094
  3. 4092
  4. 4090

 

Solution-

 

  • Number of bits reserved for network ID in the given subnet mask = 20.
  • So, Number of bits reserved for Host ID = 32 – 20 = 12 bits.
  • Thus, Number of hosts per subnet = 212 – 2 = 4094.
  • In class B, 16 bits are reserved for the network.
  • So, Number of bits reserved for subnet ID = 20 – 16 = 4 bits.
  • Number of subnets possible = 24 = 16.
  • Thus, Option (B) is correct.