IP Address Format and Table
IP address is a short form of "Internet Protocol Address." It is a unique number provided to every device connected to the internet network, such as Android phone, laptop, Mac, etc. An IP address is represented in an integer number separated by a dot (.), for example, 184.108.40.206.
Types of IP Address
An IP address is categorized into two different types based on the number of IP address it contains. These are:
What is IPv4?
IPv4 is version 4 of IP. It is a current version and the most commonly used IP address. It is a 32-bit address written in four numbers separated by a dot (.), i.e., periods. This address is unique for each device. For example, 220.127.116.11
What is IPv6?
IPv4 produces 4 billion addresses, and the developers think that these addresses are enough, but they were wrong. IPv6 is the next generation of IP addresses. The main difference between IPv4 and IPv6 is the address size of IP addresses. The IPv4 is a 32-bit address, whereas IPv6 is a 128-bit hexadecimal address. IPv6 provides a large address space, and it contains a simple header as compared to IPv4.
To know more about the difference between IPv4 and IPv6, look at our article ipv4 vs. ipv6.
IP Address Format
Originally IP addresses were divided into five different categories called classes. These divided IP classes are class A, class B, class C, class D, and class E. Out of these, classes A, B, and C are most important. Each address class defines a different number of bits for its network prefix (network address) and host number (host address). The starting address bits decide from which class an address belongs.
Network Address: The network address specifies the unique number which is assigned to your network. In the above figure, the network address takes two bytes of IP address.
Host Address: A host address is a specific address number assigned to each host machine. With the help of the host address, each machine is identified in your network. The network address will be the same for each host in a network, but they must vary in host address.
Address Format IPv4
The address format of IPv4 is represented into 4-octets (32-bit), which is divided into three different classes, namely class A, class B, and class C.
The above diagram shows the address format of IPv4. An IPv4 is a 32-bit decimal address. It contains four octets or fields separated by 'dot,' and each field is 8-bit in size. The number that each field contains should be in the range of 0-255.
Class A address uses only first higher order octet (byte) to identify the network prefix, and remaining three octets (bytes) are used to define the individual host addresses. The class A address ranges between 0.0.0.0 to 127.255.255.255. The first bit of the first octet is always set to 0 (zero), and next 7 bits determine network address, and the remaining 24 bits determine host address. So the first octet ranges from 0 to 127 (00000000 to 01111111).
Class B addresses use the initial two octets (two bytes) to identify the network prefix, and the remaining two octets (two bytes) define host addresses. The class B addresses are range between 18.104.22.168 to 22.214.171.124. The first two bits of the first higher octet is always set to 10 (one and zero bit), and next 14 bits determines the network address and remaining 16 bits determines the host address. So the first octet ranges from 128 to 191 (10000000 to 10111111).
Class C addresses use the first three octets (three bytes) to identify the network prefix, and the remaining last octet (one byte) defines the host address. The class C address ranges between 192.0.0.0 to 126.96.36.199. The first three bit of the first octet is always set to 110, and next 21 bits specify network address and remaining 8 bits specify the host address. Its first octet ranges from 192 to 223 (11000000 to 11011111).
Class D IP address is reserved for multicast addresses. Its first four bits of the first octet are always set to 1110, and the remaining bits determine the host address in any IP address. The first higher octet bits are always set to 1110, and the remaining bits specify the host address. The class D address ranges between 188.8.131.52 to 184.108.40.206. In multicasting, data is not assigned to any particular host machine, so it is not require to find the host address from the IP address, and also, there is no subnet mask present in class D.
Class E IP address is reserved for experimental purposes and future use. It does not contain any subnet mask in it. The first higher octet bits are always set to 1111, and next remaining bits specify the host address. Class E address ranges between 240.0.0.0 to 255.255.255.255.
In every IP address class, all host-number bits are specified by a power of 2 that indicates the total numbers of the host's address that can create for a particular network address. Class A address can contain the maximum number of 224 (16,777,216) host numbers. Class B addresses contain the maximum number of 216 (65, 536) host numbers. And class C contains a maximum number of 28 (256) host numbers.
Subnet address of IP address, understand with an example:
Suppose a class A address is 220.127.116.11, where 11 is a network prefix (address), and 65.27.1 specifies a particular host address on the network. Consider that a network admin wants to use 23 to 6 bits to identify the subnet and the remaining 5 to 0 bits to identify the host address. It can be represented in the Subnet mask with all 1 bits from 31 to 6 and the remaining (5 to 0) with 0 bits.
Subnet Mask (binary): 11111111 11111111 11111111 11000000
IP address (binary): 00001011 01000001 00011011 00000001
Now, the subnet can be calculated by applying AND operation (1+1=1, 1+0=0, 0+1=0, 0+0=0) between complete IP address and Subnet mask. The result is:
00001011 01000001 00011011 00000000 = 18.104.22.168 subnet address
IP Address Format IPv6
All IPv6 addresses are 128-bit hexadecimal addresses, written in 8 separate sections having each of them have 16 bits. As the IPv6 addresses are represented in a hexadecimal format, their sections range from 0 to FFFF. Each section is separated by colons (:). It also allows to removes the starting zeros (0) of each 16-bit section. If two or more consecutive sections 16-bit contains all zeros (0 : 0), they can be compressed using double colons (::).
IPv6 addresses are consist of 8 different sections, each section has a 16-bit hexadecimal values separated by colon (:). IPv6 addresses are represented as following format:
xxxx : xxxx : xxxx : xxxx : xxxx : xxxx : xxxx : xxxx
Each "xxxx" group contains a 16-bit hexadecimal value, and each "x" is a 4-bit hexadecimal value. For example:
FDEC : BA98 : 0000 : 0000 : 0600 : BDFF : 0004 : FFFF
You can also remove the starting zeros (0) of each 16-bit section. For example, the above IPv6 can be rewritten by omitting starting zeros (0) as follow:
FDEC : BA98 : 0 : 0 : 600 : BDFF : 4 : FFFF
You can also compress the consecutive sections 16-bit zeros (0 : 0) using double colons (::). But keep in mind that you can do it only once per IP address.
FDEC : BA98 : : 600 : BDFF : 4 : FFFF
IP Address Table
On the basis of ranges, IP addresses are categorized into five address classes which are given below.