What's an IP address ?
IP (Internet Protocol) address is a unique 32 bit number assigned to each machine connected
to the Internet (or an IP network), either permanently or temporarily
(by dial up connection or similar). A typical IP address looks like -
207.153.234.217
IP addresses are usually denoted as 4 decimal numbers (also called octets), separated by dots.
This format of representing an IP address is known as "dotted quad" or "dotted decimal" notation.
(There's also base 10 notation, but it is rather uncommon). Each octect is represented in binary format
by a single byte or 8 bits, thus 4 octets form a 32 bit IP address as shown above. (Note: This is valid for IP version 4 only).
Theoretically, 32 bit IP addresses can accommodate almost 232 = 4,294,967,296 (approximately 4.3 billion) machines on
an IP network, such as Internet. In reality however, the number is much less than this number because many IP address ranges are reserved for
special purpose and should not be used for another purpose.
An IP address consists of two parts, one identifying the network and one identifying the node or host.
Each network can have "X" number of nodes or hosts under it.
In the class system, the class of the address determines which part belongs to the network address,
and which part belongs to the host address. In newer CIDR (Classless Inter-Domain Routing) system, this information is specified along with the
IP address itself, thus allowing more efficient and practical allocation of IP addresses.
IP Classes
The class system has become "old" in the ever demanding Internet paradigm, it has been (partially) replaced by CIDR system,
which allows more efficient and practical allocation of IP addresses for the need of smaller networks. Nevertheless, it is important to
know and understand what class system is and how it works, which has been the backbone of the IP.
IP addresses have been classified into 5 classes and special purpose addresses, depending upon the value in the first octet. Viz-
- Class A - This is a class for very large networks, such as IBM which holds IP addresses in the range - 9.0.0.0 - 9.255.255.255.
(almost 16,777,216 IP addresses).
First Octet - - The first octet is between 1 to 126. (Starts with binary bit - 0).
Network Address - The n/w address is denoted by first 8 bits or first octet.
Host/Node Address - Host address is denoted by last 24 bits or last 3 octets.
This Network-Host IP configuration for class A can be shown as -
network.host.host.host
and each can have 1 to 3 decimals. Thus forming 126 network addresses (27 - 1) and
each of them capable of having 16,777,214 (224 -2) host addresses.
- Class B - This is a class for medium-sized networks.
First Octet - - The first octet is between 128 to 191. (Starts with binary bits - 10).
Network Address - The n/w address is denoted by first 16 bits or first 2 octets.
Host/Node Address - Host address is denoted by last 16 bits or last 2 octets.
This Network-Host IP configuration for class B can be shown as -
network.network.host.host
and each can have 1 to 3 decimals. Thus forming 16,384 network addresses (214) and
each of them capable of having 65,534 (216 -2) host addresses.
- Class C - This is a class for small-sized networks.
First Octet - - The first octet is between 192 to 223. (Starts with binary bits - 110).
Network Address - The n/w address is denoted by first 24 bits or first 3 octets.
Host/Node Address - Host address is denoted by last 8 bits or last octet.
This Network-Host IP configuration for class C can be shown as -
network.network.network.host
and each can have 1 to 3 decimals. Thus forming 2,097,152 network addresses (221) and
each of them capable of having 254 (28 -2) host addresses.
- Class D - This is a class meant for multicasting only, for sending multicast messages to other
groups of host machines.
First Octet - - The first octet is between 224 to 239. (Starts with binary bits - 1110).
The class D is a special purpose reserved class, and addresses in this range are not assigned as IP
addresses on an IP network, including Internet.
- Class E - This is a class meant for experimental purpose only.
First Octet - - The first octet is between 240 to 255. (Starts with binary bits - 1111).
The class E is also a special purpose reserved class, and addresses in this range are not assigned as IP
addresses on an IP network, including Internet.
The IP address 255.255.255.255 in this range is also known as Broadcast.
Note that all the figures given here (networks, possible hosts etc.) are only indicative,
and not accurate because of various reserved IP addresses for numerous reasons. Possibly,
for all practical purposes a valid Internet IP address will be from class A, B or C with
exceptions of Loopback Addresses and Private Networks.
Loopback
Addresses 127.0.0.0 to 127.255.255.255 are reserved for loopback, for internal testing
on a local machine. 127.0.0.1 typically refers to your own local machine, you can test this -
you should always be able to ping 127.0.0.1, irrespective of connectivity to the network,
as it represents your own machine.
IP addresses in this range are never valid Internet addresses.
Private Networks
There are 3 IP network addresses reserved for private networks.
10.0.0.0 to 10.255.255.255
172.16.0.0 to 172.31.255.255
192.168.0.0 to 192.168.255.255
They may be used by anyone setting up internal IP networks, such as organization LAN
behind a proxy server or a router. It is recommended to use them because routers on the Internet
should (and will) never forward packets coming from these addresses. These addresses are meaningful
only for the network to which they belong (Intranet). Due to this, two or more organizations may have same IP
address falling in this range assigned to two or more individual machines without any conflict.
So there is a thin chance that IP address 10.0.0.7 may belong to Bill Gates in MicroSoft,
whereas it may be assigned to my humble machine in my company ;).
Base 10
An IP address can also be represented as a decimal (base 10) number formed by 32 bits.
Although IP addresses are often written in the standard "dotted quad" notation, they can also be
converted into "base 10" numbers to obfuscate URLs.
A simple URL "http://192.18.97.35/" can also be represented as
"http://3222429987/" which will point to the same resource. To make it even more complicated,
a garbage or meaningless data can also be added to the left of it which ends with an "@" (at the rate) sign,
such as "http://SomeGarbageHere@3222429987/", which is also the same URL.
Spammers and clever webmasters often use it to obfuscate the source.
Consider following example, all these URLs listed below point to Sun's Java site.
Valid IP addresses converted to base 10 are in the range - 16777216 to 4294967295.
You can use IP Decoder tool given here to convert base 10 to standard IP
addresses and vice a versa, however make sure that you delete an "@" sign and everything to the left of it
before entering a base 10 URL in the IP decoder.
CIDR
CIDR stands for Classless Inter-Domain Routing, which is a new addressing scheme for the Internet
which allows for more efficient allocation of IP addresses than the old classes address scheme.
It has been developed primarily to take care of following issues -
- To overcome the shortage of allocable IP addresses.
- To assign IP addresses more efficiently, in order to cater to various sized networks.
A Class C network is capable of having 254 hosts, but not all class C networks needed all these
hosts, as a result a very small percentage of the assigned IP addresses were used. This was even more
prominent for Class A and Class B networks. CIDR was developed to be a much more efficient method of
assigning addresses. CIDR allows networks as small as 32 hosts to networks as big as 524,288 hosts,
thus reducing lot of "wasted" IP addresses.
A typical CIDR IP address looks like -
207.17.10.36/26
where "/26" indicates that first 26 bits are used for network address and rest
6 bits are used for hosts (nodes), allowing about 62 hosts, which is approximately one fourth (1/4)
of Class C.
The Internet today is a mixture of CIDR and old Classes scheme, while
CIDR becoming more and more popular and classes scheme more or less obsolete. Most new routers
support CIDR and standards recommend it.
It is not feasible to cover it in more details here, I'll probably write a new article about
CIDR once I know more about it.
IP Decoder
IP decoder is a small web based tool that lets you verify whatever you've learned here
about IP addresses. As of now, it can only verify and decode base 10 and standard "dotted quad"
IP addresses, CIDR format can not be decoded or verified. You can use this tool for
various purposes including -
- Verify an IP address, and optionally include/exclude Loopback, Private Networks and Class D, E addresses
from the list of valid IP addresses.
- Detect the Class or special range to which the IP address belongs, and get more information about
that Class/range.
- Separate Network and Host (node) address from an IP address, based on the Classes scheme.
- Convert a standard "dotted quad" IP address to base 10 and vice a versa. Ensure that you delete an "@"
sign and everything to the left of it before entering a base 10 URL in the IP decoder.
A Little Note
I do not really have any expertise in Networking, I have gathered this information (because
I needed it for some project) from various books, news group, online RFCs and articles.
It is quite possible that some of the information might be inaccurate/incorrect,
though I have verified it with standard information and few experts of the field from time to time.
I would be very grateful if you could inform me about any such bug or inaccuracy/incorrectness.
If you find it useful, if you have any suggestions; I'd love hear from you, do
and make good use of this tool.