To allow for global communications each device on the Internet must have a unique address that distinguishes it from any other device on the Internet. This identifying address is called the IP address because it is used in the network (or IP) layer of the OSI (Open Systems Interconnection) model. The IP address is made up of four bytes (32 bits) that uniquely identify a computer or router on the Internet. Being unique means that each IP address is given to one and ONLY one computer or node. Because there are only 32 bits available in an IP address this means that only 2^32 or 4,294,967,296 (more than four billion) IP address are available. However, because some addresses are used for special purposes the real number is much less. There are three common ways in which IP address can be represented. 1) There is the binary notation which uses the base two number system to represent numbers. 2) There is the decimal notation which uses the base ten number system to represent numbers. 3) There is the hexadecimal notation which uses the base sixteen number system to represent numbers. In this tutorial I will use the decimal notation number system since it is the easiest and most familiar number system to humans. However, be aware that computers use the binary notation number system because computers only understand two values which are '0' or '1'. This is analogous to a switch which can have two values 'on' or 'off'. In fact, your computer contains millions of electronic switches. An IP address is made up of four bytes. Each byte contains eight bits which means the numbers in each byte can range from 0 to 2^8-1 or 0 -255.
When IP addresses were first started they used the concept of classes. The range of IP addresses were divided into five classes: A, B, C, D, and E. Class A used up 50% of the address space, class B used up 25%, class C used up 12.5%, class D used up 6.25%, and class E also used up 6.25%. The way you recognize which class an IP address belongs to is by analyzing the first byte. If the number in the first byte is between 0-127, then the IP address is in the Class A range. If it is between 128-191 it is in Class B. If it is between 192-223 it is in the Class C range. If it is between 224-239 it is in the Class D range, and if it is between 240-255, then it belongs to Class E. Let's look at an example.
An IP address is divided into a network ID (netid) and a host ID (hostid). The lengths of the netid vary depending on the class the IP address belongs to. In class A the netid occupies the first byte and the hostid occupies the remaining three bytes. In class B the netid occupies the first two bytes and the hostid occupies the remaining two bytes. In class C the first three bytes define the netid and the last remaining byte defines the hostid. Class D and E are not divided into netid and hostid. The following figure shows how the netid and hostid are divided in Classes A, B, and C.
Let's take a look at an example.
In classful addressing the netid and hostid are easily distinguishable by looking at the IP address. First you have to determine which class the IP address belongs to and from there you can tell which part is the netid and which part is the hostid. If it is in Class A, then the first byte represents the netid and the last three represent the hostid, and so on. There is one huge problem with classful IP addressing. It wastes a lot of IP addresses and since the Internet keeps growing larger, we can't afford to throw away IP addresses. That is why a new addressing scheme was devised. It is called classless addressing because it doesn't use the classes which were used in classful addressing. In classless addressing the entire range of IP addresses is divided into blocks of variable sizes. Depending on the needs of an organization, it is assigned an appropriate IP address along with a mask that denotes which part is the netid and which part is the hostid. The format of a classless IP address is x.y.x.t /n.
You may be wondering why we need to
separate an IP address into netid and hostid. The reason is that the
Internet consists of networks. Each network has a unique ID. In order for
routers to route the packets correctly they must extract the netid from the
IP address, and based on that it will know where to send the packet next.
Earlier in this tutorial I stated that every IP address can only be
associated with one computer. However, there is an exception. The exception
is using Private Network Addresses. They include 10.x.x.x, 172.16.x.x
through 172.31.x.x, and 192.168.x.x. These IP addresses are not routable on
the Internet. They have been reserved for use in private networks. For
example, if you have three
| ||||||||||||||||||||||