Home Tell a Friend Contact Us Arabic

 

 

                                                                      Working with IP Address

A. Awadhi

IP Address consists of 32 bits divided in to four groups, each group is one byte or Octet - a Byte is eight Bits- separated by a dot and they expressed usually in decimal like 192.120.168.23, the range of each byte is from 0 to 255.

In IP address some bytes are network address and some are host address, this depend on class type which can be identified by first byte number.

 

XXX

.

XXX

.

XXX

.

XXX

 

Byte 1

 

Byte 2

 

Byte 3

 

Byte 4

Class A:

N

 

H

 

H

 

H

Class B:

N

 

N

 

H

 

H

Class C:

N

 

N

 

N

 

H







IP Address classes and ranges.


Class

First Byte range

No. of Host Addresses

Class A

1 to 126

2^24-2

Class B

128 to 191

2^16-2

Class C

192 to 223

2^8-2

As we can see above, class A can take more host addresses and Class C can take more network addresses, however class B has equal number of addresses. Please note that there are two reserved host addresses per network that is why -2 is involved in the calculation. The two reserved addresses are Network address & Broadcast address, these two addresses must not be assigned to any host or interface in the network.


Class

Usable Network Add

A

1.0.0.0 to 126.0.0.0

B

128.1.0.0 to 191.254.0.0

C

192.0.1.0 to 223.255.254.0


Each class also has a default subnet mask address, they are as follows.

 

Class A:

255.0.0.0

Class B:

255.255.0.0

Class C:

255.255.255.0


The Router will use the subnet mask address to find out the network that the destination host is located in. This can be achieved by using AND Function after converting to binery, by ANDing host address with its subnet mask address we can get network address.

See the example below for a class B IP Address:

Host IP Address

:

140.179.240.201

10001100.10110011.11110000.11001001

Subnet mask address

:

255.255.0.0  

11111111.11111111.00000000.00000000     

Resultant Network Address

:

140.179.0.0

10001100.10110011.00000000.00000000







Subnetting.

Each of the above Network classes can be subdivided in to many smaller groups, for example we can divided the last byte which is Host address of a class C address like 192.20.20.0 in to two groups by borrowing few bits to make a subnet.

 

The benefit of Subnetting is to create multiple logical networks that exist within a single class A, B, or C network. Without subnetting we can only use one network from class A, B, or C network, let us see some examples.

Example 1:

We have a class C address 192.20.20.0 with default subnet mask 255.255.255.0

We need to extract 8 subnets from this address.

 

First step is to write the last byte in binary as follows.

192.20.20.

0

0

0

0

0

0

0

0

 

128

64

32

16

8

4

2

1


Since we need 8 subnets, then 3 bits must be borrowed 2^3=8

So the number of subnets will be 2^3=8 and number of usable subnets addresses is 8-2=6.

Accordingly, number of  hosts per subnet is 2^5= 32 and number of usable Host addresses is 32-2=30.


Now a new subnet mask is formed, we can calculate it by adding the three bits at left of the vertical line 128+64+32=224, so the new subnet mask will be 255.255.255.224

 

Now we can write down the range of subnets available as follows.


 

Network addr.

 

Broadcast addr.

Remarks

First subnet

192.20.20.0

to

192.20.20.31

(Not valid)

Second subnet

192.20.20.32

to

192.20.20.63

Add 32 to last byte

Third subnet

192.20.20.64

to

192.20.20.95

 

Fourth subnet

192.20.20.96

to

192.20.20.127

 

Fifth subnet

192.20.20.128

to

192.20.20.159

 

Sixth subnet

192.20.20.160

to

192.20.20.191

 

Seventh subnet

192.20.20.192

to

192.20.20.223

 

Eighth subnet

192.20.20.224

to

192.20.20.255

(Not valid)


Example 2:

IP Address 204.15.6.0

11001100.00001111.00000101.0000

0000

Subnet mask 255.255.255.240

11111111.11111111.11111111.1111

0000

 

                                             sub

 


In this example from subnet mask we can find number of subnets and host per subnet by looking in to the last byte
of subnet mask.

Four bits were borrowed for subnet and four bits remained for host, therefore 2^4=16 Subnet and 16 hosts. 
(Remember we can
assign only 14 addresses to devices)

Related links

 

http://www.ralphb.net/IPSubnet/

http://www.cisco.com/warp/public/701/3.html

http://jodies.de/ipcalc


 

 

Copyright © eFarabi, All rights reserved.
Designed & developed by: eeWebSolutions.com