TCP/IP (Transmission Control Protocol/Internet Protocol) is the basic communication language or protocol of the Internet. It can also be used as a communications protocol in a private network (either an intranet or an extranet).
IP Address is Logical Address given to each and every device in the network. It is a Network Layer address (Layer 3). There are two versions of IP:
IPv4 was developed in 1980’s. It is a 32-bit representation with totally 4.3 billion addresses.
To overcome the IPv4’s “small” amount of addresses, people come up with IPv6. IPv6 was developed in 1990’s. It is a 128-bit representation with approximately 3.4×10^38 addresses.
Besides IPv6, another solution called NAT (Network Address Translation) was suggested to extend the IPv4 usage .
NAT allows 60,000 users to go to a single IP address.
In the original Internet routing scheme developed in the 1970s, sites were assigned addresses from one of three classes: Class A, Class B and Class C. The address classes differ in size and number. Class A addresses are the largest, but there are few of them. Class Cs are the smallest, but they are numerous. Classes D and E are also defined, but not used in normal operation.
IP address is divided into Network & Host Portion.
- Host: a specific device in the network
- Network: set of devices
For Class A, the network portion is the first number. For Class B and C, their network portions are the first two numbers and the first three numbers respectively.
|CLASS||NETWORK & HOST||START IP|
This addressing scheme is illustrated in the following table frow Wikipedia:
The number of addresses usable for addressing specific hosts in each network is always 2^N - 2 (where N is the number of rest field bits, and the subtraction of 2 adjusts for the use of the all-bits-zero host portion for network address and the all-bits-one host portion as a broadcast address. Thus, for a Class C address with 8 bits available in the host field, the number of hosts is 254.
If two devices in a LAN want to communicate with each other, they have to be in the same network. For example, we have two devices with IP addresses
192.168.2.1. They IP addresses suggest that they belong to CLASS C, whose network portions consume the first three numbers in their IPs. Since the first device’s network portion is
192.168.1 and the second one’s network portion is
192.168.2, they belong to different networks. They are not logically same even though they are in the same LAN and physically connected.
For each network, as stated above we cannot use the first IP and neither the last one. The first IP is called Network Address and the other one is called Broadcast Address. For example, in the network
192.168.1.0 is the Network Address and
192.168.1.255 is the Broadcast Address.
The Network Address is reserved to identify the network. It is useful during routing.
The Boradcast Address is reversed for broadcasting within the same network.
The remaining addresses are valid IP addresses. Only valid IP addresses can be assigned to hosts/clients.
Subnet Mask differentiates Network portion and Host Portion:
|CLASS||NETWORK & HOST||MASK VALUE|
Check out this post for more information :)
If we design a LAN, we can consider the private IP.
- Used within the LAN or within the organization
- Not recognized on Internet
- Given by the admin
- Unique within the network or organization
- Unregistered IP
If we want to go to Internet, we need a public IP.
- Used on public network (Internet)
- Recognized on Internet
- Given by the service provider (from IANA)
- Globally unique
- Pay to service provider (or IANA)
When we connect to the Internet from a host within a LAN, the router will translate our private IP into a public IP, which is called
Network address translation or
NAT. So how to identify whether an IP address is a private IP address or a public IP address?
There are certain addresses in each class of IP address are reserved for Private Network. These addresses are called private address.
|CLASS||START IP||END IP|
According to the Wikipedia post on ICDR:
During the first decade of the Internet after the invention of the Domain Name System (DNS) it became apparent that the devised system based on the classful network scheme of allocating the IP address space and the routing of IP packets was not scalable.
To overcome this shortcommings, CIDR was introduced in 1993 to replace the previous classful addressing network design. In CIDR, IPs are no longer categorized as A/B/C/D classes. An IP address is described as two group of digits. The most significant bits are the network address, which indicates the whole network or a subnet, while the least significant bits serve as host identifiers.
CIDR notation is a compact representation of an IP address and its associated routing prefix. The notation is constructed from an IP address, a slash (‘/‘) character, and a decimal number. The number is the count of leading 1 bits in the routing mask, traditionally called the network mask.
For example, in CIDR,
22.214.171.124/26 will have a network address of
126.96.36.199 and broadcast address of
188.8.131.52. Any devices will need to sit between
184.108.40.206. In ICDR, the previous classful network can be simply represented as
XX.XX.XX.XX/8 for A,
XX.XX.XX.XX/16 for B and
XX.XX.XX.XX/24 for C.
The subnets will be their own segment entirely, and will not be able to communicate with eachother without using routes. Devices in a subnet will only be able to “see” other devices on their own localized smaller subnet.