I'm not able to get what a private IP address is, and why is it used?
Though I searched for it in Google, I'm not able to get it. Can anyone explain me with an example?
I think your questions can be answered by looking at the RFCs. RFC 1918, Address Allocation for Private Internets defines private IP addressing.
You can make up your own addressing from any of the private IP address ranges defined in Section 3:
- Private Address Space
The Internet Assigned Numbers Authority (IANA) has reserved the following three blocks of the IP address space for private internets:
10.0.0.0 - 10.255.255.255 (10/8 prefix) 172.16.0.0 - 172.31.255.255 (172.16/12 prefix) 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
Section 2 gives the reason for private IP addressing:
With the proliferation of TCP/IP technology worldwide, including outside the Internet itself, an increasing number of non-connected enterprises use this technology and its addressing capabilities for sole intra-enterprise communications, without any intention to ever directly connect to other enterprises or the Internet itself.
The Internet has grown beyond anyone's expectations. Sustained exponential growth continues to introduce new challenges. One challenge is a concern within the community that globally unique address space will be exhausted. A separate and far more pressing concern is that the amount of routing overhead will grow beyond the capabilities of Internet Service Providers. Efforts are in progress within the community to find long term solutions to both of these problems. Meanwhile it is necessary to revisit address allocation procedures, and their impact on the Internet routing system.
To contain growth of routing overhead, an Internet Provider obtains a block of address space from an address registry, and then assigns to its customers addresses from within that block based on each customer requirement. The result of this process is that routes to many customers will be aggregated together, and will appear to other providers as a single route [RFC1518], [RFC1519]. In order for route aggregation to be effective, Internet providers encourage customers joining their network to use the provider's block, and thus renumber their computers. Such encouragement may become a requirement in the future.
With the current size of the Internet and its growth rate it is no longer realistic to assume that by virtue of acquiring globally unique IP addresses out of an Internet registry an organization that acquires such addresses would have Internet-wide IP connectivity once the organization gets connected to the Internet. To the contrary, it is quite likely that when the organization would connect to the Internet to achieve Internet-wide IP connectivity the organization would need to change IP addresses (renumber) all of its public hosts (hosts that require Internet-wide IP connectivity), regardless of whether the addresses used by the organization initially were globally unique or not.
It has been typical to assign globally unique addresses to all hosts that use TCP/IP. In order to extend the life of the IPv4 address space, address registries are requiring more justification than ever before, making it harder for organizations to acquire additional address space [RFC1466].
Hosts within enterprises that use IP can be partitioned into three categories:
Category 1: hosts that do not require access to hosts in other enterprises or the Internet at large; hosts within this category may use IP addresses that are unambiguous within an enterprise, but may be ambiguous between enterprises.
Category 2: hosts that need access to a limited set of outside services (e.g., E-mail, FTP, netnews, remote login) which can be handled by mediating gateways (e.g., application layer gateways). For many hosts in this category an unrestricted external access (provided via IP connectivity) may be unnecessary and even undesirable for privacy/security reasons. Just like hosts within the first category, such hosts may use IP addresses that are unambiguous within an enterprise, but may be ambiguous between enterprises.
Category 3: hosts that need network layer access outside the enterprise (provided via IP connectivity); hosts in the last category require IP addresses that are globally unambiguous.
We will refer to the hosts in the first and second categories as "private". We will refer to the hosts in the third category as "public".
Many applications require connectivity only within one enterprise and do not need external (outside the enterprise) connectivity for the majority of internal hosts. In larger enterprises it is often easy to identify a substantial number of hosts using TCP/IP that do not need network layer connectivity outside the enterprise.
Some examples, where external connectivity might not be required, are:
A large airport which has its arrival/departure displays individually addressable via TCP/IP. It is very unlikely that these displays need to be directly accessible from other networks.
Large organizations like banks and retail chains are switching to TCP/IP for their internal communication. Large numbers of local workstations like cash registers, money machines, and equipment at clerical positions rarely need to have such connectivity.
For security reasons, many enterprises use application layer gateways to connect their internal network to the Internet. The internal network usually does not have direct access to the Internet, thus only one or more gateways are visible from the Internet. In this case, the internal network can use non-unique IP network numbers.
Interfaces of routers on an internal network usually do not need to be directly accessible from outside the enterprise.
Basically, without private IP addressing, we would have run out of IPv4 addresses many years ago. There simply are not enough IPv4 addresses to for everyone to have a unique IPv4 address, which was the original premise of IP. To restore this premise and the end-to-end nature of IP, the IETF created IPv6.
Private IPv4 addresses allow you to run a network without applying for public IP addresses at your regional registry. Since IPv4 addresses have run out it's the only way to set up a new network or expand an existing one.
Private IPv6 addresses allow you to design your network in such a way that some entirely local services simply can't communicate with the outside world.
(note: this answer limits itself to IPv4, the IPv6 side of things is interesting but it's drifting a bit far from the question topic)
The original intent of private addresses was to allow people to run networks that didn't directly exchange packets with the global Internet without needing to assign global addresses to all machines on those networks. This saved addresses, and reduced the likelihood of inadvertant communication between those hosts and the outside works.
Later NAT came along. This allowed hosts with private addresses to make outgoing TCP/UDP connections to hosts on the public Internet. The NAT would replace the address and port used by the client with a globally reachable address and a suitable port (which may or may not be the same as the port the client originally used) and keep a mapping table so that replies could be translated.
Many companies found the advantages of running private IP addresses with NAT compelling. There was less possibility of inadvertantly exposing stuff to the whole world, no need to justify address usage, no need to pay per-address fees that some ISPs charged and for smaller companies no need to readdress their systems when changing ISP (for larger companies the final point was not an issue because they could get provider-independent address allocations).
In the home and mobile sectors too NAT became common. In the home case NAT became ubiquitous with the move from plain modems to "home routers". In the mobile case NAT was implemented at the ISP level.
So nowadays the vast majority of end-user systems use a private IP address behind a NAT.