Welcome to Assyrian Cafe Articles

We've redesigned the website [NEW]








 

 
IP Address Tutorial

by Simon Salomon

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. 

Example 1:

DePaul University's IP address  is 140.192.23.180. This IP address consists of four bytes.  The first byte has the value 140.  The second byte has the value of 192. The third byte has the value 23, and the fourth byte has the value 180.

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.

Example 2:

Depaul University's IP address is 140.192.23.180.  Looking at this address we can see that the first byte is 140.  Since 140 is between the numbers 128-191, we know that it is in the Class B range.    

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.

Example 3:
 

DePaul University's IP address  is 140.192.23.180.  This IP address consists of four bytes.  Since this IP address belongs to Class B that means that the first two bytes represent the netid and the last two bytes represent the hostid.  In this example the 140.192.0.0 represents the netid and the 0.0.23.180 represents the hostid.

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.

Example 4:
 

Given this classless IP address 140.120.80.0/16 provide the netid.

 
Solution:
 

The /16 means that the first two bytes or 16 bits of the IP address 140.120.80.0 represent the netid.  Since the first 16 bits represent the number 140.120.  This means that the netid is 140.120.0.0.

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
computers at home and you have only one connection and you want all the computers to be able to access the Internet, then you will need to NAT them. In order to use NAT you have to have a router or firewall that is capable of performing NAT. Then, you must set up the Dynamic Hosting Configuration Protocol (DHCP) server to assign IP addresses from the private address space to each internal computer. Once you have NAT set up what happens is anytime one
of your computers wants to access the Internet its private IP address will be translated to the public IP address that is assigned to you by your ISP. Using NAT you are able to create your own internet and connect it to the Internet using one public IP address.
This concludes the tutorial on IP addresses for IP version 4. I hope you now have a fairly good idea of what IP addresses are and their importance to telecommunications.
 

Resources

 

Wikipedia, “IP address”,
http://en.wikipedia.org/wiki/Ip_address
 

Forouzan, Behrouz, 2006, TCP/IP Protocol Suite, McGraw-Hill, New York, NY

 

©2006 AssyrianCafe.com | Assyrian Parties, Games, Mar Sargis Church, Yellow Pages