Saturday 22 November 2014

What is an IP address?

Image Source: Wisegeek A Brief Overview of IP Addresses An IP address (Internet Protocol address) is an assigned numerical label... thumbnail 1 summary
Image Source: Wisegeek

A Brief Overview of IP Addresses


An IP address (Internet Protocol address) is an assigned numerical label that is used to 
identify Internet communicating devices on a computer network. Think of it like this: An IP address is to a computer what a telephone number is to a house. Each computer or house 
can stand alone without its respective IP address or telephone number. However, if you want 
to be able to communicate with people in other houses from within your house, you will need a telephone number. In a like manner, if you would like to communicate with other computers 
from yours, you will need an IP address.


Technical Facts about an IP Address


  • An IP address is a set of four numbers divided by periods
  • The numbers of an IP address range from 0 to 255


In more technical terms:


  • An IP address is a 32 bit binary number that is divided into four sections by periods
  • Each individual set of numbers in an IP address is called an octet
  • There are four octets in an IP address and each octet is 8 bits
  • An octet can range from 0 to 255 in value. (255 is the largest number that you can represent with 8 bits)


Internal vs External IP Addresses


If you are using a home router then you likely have both an External and Internal IP address.
Your External IP address will be issued to you by your ISP (Internet Service Provider). 
Because an IP address acts as identification number, no two computers on the Internet can have the same External IP address. Your External IP address will be the IP address that is 
used to contact your computer by the outside world.

Everything connected on your side of your router is in your local network and is designated a uniqueInternal IP address. In most cases, Internal IP addresses are issued by your router, but you may set a static IP address for the nodes in your local network. 
There are some IP address ranges that are commonly used for internal networks. Here are a few examples of what these addresses look like:

192.168.x.x
10.0.x.x
10.1.x.x
172.x.x.x

Where x can represent any number from 0 to 255.
Static vs Dynamic IP Addresses

Dynamic IP addresses are IP addresses that are vended by a router to a node when necessary. As their name would suggest Dynamic IP addresses are not fixed and are subject to change. Dynamic IP addresses are a handy network function but they can cause problems when trying to do more advanced networking proceedures like port forwarding. If the IP address to which you port forward changes, then your port forwards no longer work.

Static IP addresses are unchanging IP addresses that are assigned to a network node. Static IP addresses will never change. When using Static IP addresses you lose a small amount of plug and play functionality, but you gain reliability. 
Please note that for almost all purposes regarding port forwarding you will only need to set up a static Internal IP address.

IP "Classful" Addressing Overview and Address Classes 


When the first precursor of the Internet was developed, some of the requirements of the internetwork, both present and future, were quickly realized. The Internet would start small but eventually grow. It would be shared by many organizations. Since it is necessary for all IP addresses on the internetwork to be unique, a system had to be created for dividing up the available addresses and share them amongst those organizations. A central authority had to be established for this purpose, and a scheme developed for it to effectively allocate addresses.
The developers of IP recognized that organizations come in different sizes and would therefore need varying numbers of IP addresses on the Internet. They devised a system whereby the IP address space would be divided into classes, each of which contained a portion of the total addresses and were dedicated to specific uses. Some would be devoted to large networks on the Internet, while others would be for smaller organizations, and still others reserved for special purposes.
Since this was the original system, it had no name; it was just “the” IP addressing system. Today, in reference to its use of classes, it is called the “classful” addressing scheme, to differentiate it from the newer classless scheme. As I said at the end of the introduction to this section, “classful” isn't really a word, but it's what everyone uses.

IP Address Classes


There are five classes in the “classful” system, which are given letters A through E. Table  provides some general information about the classes, their intended uses and other general characteristics about them:


Looking at this table you can see that the first three, classes A, B and C, comprise most of the total address space (7/8ths of it). These are the classes used for unicast IP addressing, which means for messages sent to a single network interface. (The blocks also include associated broadcast addresses for these networks.) This is what we usually consider “normal” IP addressing. You can think of classes A, B and C as the “papa bear”, “mama bear” and “baby bear” of traditional IP addressing. They allow the Internet to provide addressing for a small number of very large networks, a moderate number of medium-sized organizations, and a large number of smaller companies. This approximately reflects the distribution of organization sizes, approximately, in the real world, though the large gulf in the maximum number of hosts allowed for each address class leads to inflexibility and problems.

As you can see, the classes differ in the place where the “dividing line” is drawn between the network ID and the host ID portions of the addresses they contain. However, in each case the division is made on octet boundaries: in classful addressing, the division does not occur within an octet.


 Division of IPv4 Address Space Into Classes



Classes D and E are special—to the point where many people don't even realize they exist. Class D is used for IP multicasting, while class E was reserved for “experimental use”.

The “classful” IP addressing scheme divides the total IP address space into five classes, A through E. One of the benefits of the relatively simple “classful” scheme is that information about the classes is encoded directly into the IP address. This means we can determine in advance which address ranges belong to each class. It also means the opposite is possible: we can identify which class is associated with any address by examining just a few bits of the address.
This latter benefit was one of the main motivators for the initial creation of the “classful” system, as we saw in the previous topic.

"Classful" Addressing Class Determination Algorithm


When TCP/IP was first created computer technology was still in its infancy, compared to its current state. Routers needed to be able to quickly make decisions about how to move IP datagrams around. The IP address space was split into classes in a way that looking at only the first few bits of any IP address would tell the router where to “draw the line” between the network ID and host ID, and thus what to do with the datagram.
The number of bits the router needs to look at may be as few as one or as many as four, depending on what it finds when it starts looking. The algorithm used corresponds to the system used to divide the address space; it involves four very basic steps.






If the first bit is a “0”, it's a class A address and we're done. (Half the address space has a “0” for the first bit, so this is why class A takes up half the address space.) If it's a “1”, continue to step two.
If the second bit is a “0”, it's a class B address and we're done. (Half of the remaining non-class-A addresses, or one quarter of the total.) If it's a “1”, continue to step three.
If the third bit is a “0”, it's a class C address and we're done. (Half again of what's left, or one eighth of the total.) If it's a “1”, continue to step four.
If the fourth bit is a “0”, it's a class D address. (Half the remainder, or one sixteenth of the address space.) If it's a “1”, it's a class E address. (The other half, one sixteenth.)
And that's pretty much it.

In the preceding topics I introduced the concepts of IP address classes and showed how the classes related to ranges of IP addresses. Of the five classes, D and E are dedicated to special purposes, so I will leave those alone for now. Classes A, B and C are the ones actually assigned for normal (unicast) addressing purposes on IP internetworks, and therefore the primary focus of our continued attention.
As we've seen, they differ in the number of bits (and octets) used for the network ID compared to the host ID. The number of different networks possible in each class is a function of the number of bits assigned to the network ID, and likewise, the number of hosts possible in each network depends on the number of bits provided for the host ID. We must also take into account the fact that one, two or three of the bits in the IP address is used to indicate the class itself, so it is effectively "excluded" from use in determining the number of networks (though again, it is still part of the network ID).
Based on this information, we can calculate the number of networks in each class, and for each class, the number of host IDs per network shows the calculations.


Let's walk through one line of this table so we can see how it works. I'll stick with class B since it's "in the middle". The basic division is into 16 bits for network ID and 16 bits for host ID. However, the first two bits of all class B addresses must be "10”, so that leaves only 14 bits to uniquely identify the network ID. This gives us a total of 214 or 16,384 class B network IDs. For each of these, we have 216 host IDs, less two, for a total of 65,534.
Why less two? For each network ID, two host IDs cannot be used: the host ID with all zeroes and the ID with all ones. These are addresses with "special meanings" as described in the topic that follows. You will also notice that 2 has been subtracted from the number of network IDs for class A. This is because two of the class A network IDs (0 and 127) are reserved. There are actually several other address ranges that are set aside in all three of the classes that I haven't shown here. They are listed in the topic on reserved, private and loopback addresses. (The exclusion of 0 and 127 from class A is probably the best-known address range reservation which is why I am explicit with that one in the table above.)

As you can see, there is quite a disparity in the number of hosts available for each network in each of these classes. What happens if an organization needs 1,000 IP addresses? They have to either use four class Cs or use one class B (and in so doing waste over 90% of the possible addresses in the class B network.) Bear in mind that there are only about 16,000 class B network IDs available worldwide and you begin to understand one of the big problems with "classful" addressing.