A class A address always starts with a 0. Thus half of the IP addresses are class A addresses. A class B, C  D and E address start with a  1. Now lets look at the second bit. If it is a 0 it is a class B address. Class B addresses make up ¼ th of the address space. Thus all addresses that start with 1 0 are class B. Thus class C, D and E addresses begin with 1 1. Now lets look at the third bit. If it is 0 i.e. 1 1 0 it is a class C address.  Class C addresses are 1/8 of all IP addresses. A class D and E begin with 1 1 1. Class D is thus 1 1 1 0 and class E is 11 1 1. Thus class D and E take up 1/16 of the address space. Class D is for IP multicasting and Class E is reserved for future use. A single Class A address is 16 million ip address.

Class A range is 1.0.0.0 to 126.255.255.255. Class B is 128.0.0.0 to 191.255.255.255. Class C is 192.0.0.0 to 223.255.255.255. Class D is 224.0.0.0 to 239.255.255.255. Class E is 240.0.0.0 to 255.255.255.255

Some ip address that start with 127 are reserved for loop back and 255.255.255.255 is the IP broadcast address. The class C address 192.0.0.0 to 192.0.0.255 is reserved.  A class A address uses 8 bits for network, 24 for host. Class B is 16 16 and class C is 8 for network, 24 for host. An IP address with 1’s means a broadcast or everyone, with zeroes means this. Thus if the network portion is all zeroes, the host is on this network. Thus IP address with all zeroes and one’s cannot be used.

A loop back address packet is not send to the data link layer. It is used to test only the tcp/ip functionality of the stack. Thus some sniffers do not trap loop back packets as they are not really send by the system.

Some IP addresses like are reserved for companies to use them as internal ip address. These are 10.0.0.0 to 10.255.255.255, 128.0.0.0 to 128.0.255.255,169.254.0.0 to 169.254.255.255 etc etc.

Earlier we used a two level hierarchy network and host. We now divide the host into sub net and host. This allows us a network within a network. A phone number is the best example of a 3 level address. In sub nets we steal bits from the host and keep the network the same.

In a subnet mask we keep the bits for the network and the sub net as 1, for the host as 0. Thus the subnet mask 255.255.255.0 means that the first 24 bits are used for the network and the subnet mask. 8 bits are reserved for the host. There is no way of telling which bits are for the network and sub net,

The default sub net masks are 255.0.0.0 for Class A, 255.255.0.0 for class B, and 255.255.255.0 for Class C.