What is IP ?
An IP addresses is a unique logical number to a network device or interface. Every device has a logical address in network layer of OSI model or in data network for packet routing which is called IP address. Internet Protocol is a protocol use for communication and for routing packets throughout data network.
IPv4 Addressing
The IPv4 addresses are divided into five classes i.e. Class A, B, C, D and E. Each IP address class is identified by the initial bits of the address.
IP Classes | Initial Bits | Address Ranges |
Class A | 1-126 | 1.0.0.1 to 126.255.255.254 |
Class B | 128-191 | 128.1.0.1 to 191.255.255.254 |
Class C | 192-223 | 192.0.1.1 to 223.255.254.254 |
Class D | 224-239 | 224.0.0.0 to 239.255.255.255 |
Class E | 240-254 | 240.0.0.0 to 254.255.255.254 |
126.x.x.x is reserved for multi cast address. Classes A, B, and C are unicast IP addresses, meaning that the destination is a single host. IP Class D addresses are multicast addresses, which are sent to multiple hosts. IP Class E addresses are reserved. IP addresses are divided into two groups i.e.
- Public IP address
- Private IP address
Private IP addresses are selected address ranges that are reserved for use by companies in their private networks. These private addresses are not routed in the Internet. NAT translates between private and public addresses. Following are the IP ranges that can be used in private network:
From 10.0.0.0 to 10.255.255.255
From 172.16.0.0 to 172.31.255.255
From 192.168.0.0 to 192.168.255.255
An IPv4 address is 32 bits in length. An IPv4 consist of four octets and every octet is of 8-bit, each converted into decimal numbers (for example, 10.1.1.1). Each bit in every octet is representing or equivalent to a number into decimal.
Bit | 1st | 2nd | 3rd | 4th | 5th | 6TH | 7TH | 8th |
Decimal Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
You can get a decimal number by adding all on bits, for example you can represent the IP 174.50.242.10 into binary to decimal by following:
First Octet | 2nd Octet | 3rd Octet | 4th Octet | |
Binary IP address: | 10101110 | 00110010 | 11110010 | 00001010 |
Binary into Decimal conversion | 128+0+32+0+ +8 +4 +2 +0=174 | 0 +0 +32 +16 +0 +0 +2 +0 = 50 | 128 +64 +32 +16 +0 +0 +2 +0 = 242 | 0 +0 +0 +0 +8 +0 +2 +0 = 10 |
Decimal IP address: | 174 | 50 | 242 | 10 |
Class A IP Addresses
Class A IP addresses range from 0 to 127 in the first byte. Network numbers available for assignment to organizations are from 1.0.0.0 to 126.0.0.0. Networks 0 and 127 are reserved. For example, 127.0.0.1 is reserved for local host or host loopback. A packet sent to a local host address is sent to the local machine. By default, in Class A IP addresses, the first byte is representing the network portion, and the three remaining bytes are the host number. The format is N.H.H.H, where N is the network part and H is the host part. With 24 bits available, there are 6,777,214 (224 – 2) IP addresses for host assignment per Class A network. We subtract two for the network number (all 0s) and broadcast address (all 1s).
Class A Address format | Network | Host | Host | Host |
Class B IP Addresses
Class B addresses range from 128 to 191 in the first byte. Valid IP range for Class D IP addresses are from 128.0.0.0 to 191.255.0.0. By default, for Class B addresses, the first two bytes are the network part, and the remaining two bytes are the host number. The format is N.N.H.H. With 16 bits available, there are 216 – 2 = 65,534 IP addresses for host assignment per Class B network. As with Class A addresses, having a segment with more than 65,000 hosts broadcasting will surely not work; you resolve this issue with subnetting.
Class B Address format | Network | Network | Host | Host |
Class C IP Addresses
Class C addresses range from 192 to 223 in the first byte. Network numbers assigned to companies are from 192.0.0.0 to 223.255.255.0. The format is N.N.N.H. With 8 bits available, there are 28 – 2 = 254 IP addresses for host assignment per Class C network. H = 0 is the network number; H = 255 is the broadcast address.
Class B Address format | Network | Network | Host | Host |
Class D IP Addresses
Class D addresses range from 224 to 239 in the first byte. Network numbers assigned to multicast groups range from 224.0.0.1 to 239.255.255.255. These addresses do not have a host or network part. Some multicast addresses are already assigned; for example, 224.0.0.10 is used by routers running EIGRP.
Class E IP Addresses
Class E addresses range from 240 to 254. These addresses are reserved for experimental networks. Network 255 is reserved for the broadcast address, such as 255.255.255.255.
IPv4 Address Type
IPv4 addresses can be divided into one of three types:
- Unicast IPv4 address: The IP address of an interface on a single host is called unicast address. It can be a source or destination address
- Broadcast IPv4 address: An IP address that reaches all hosts in an address range is called broadcast address. It is only a destination address.
- Multicast IPv4 address: An IP address that reaches a group of hosts. It is only a destination address