An IP address is an address used to uniquely identify a device on an IP network. An IP network is nothing but a connection of multiple computers forming a network. An IP address can be given to any kind of network component that has to communicate over the network, such as computers, servers, routers, switches, etc. Any two computers, or any other network devices, cannot communicate with each other if they do not have an assigned IP address. They are designed to uniquely identify each network device and allow them to communicate with each other, regardless of the physical location of the sender and receiver.
Hence, an IP address is the unique identity of any network device where each one should have their own IP address defined. On the Internet, computers are recognized by their IP addresses only. IP addresses have an equal significance as the postal addresses have for human beings. Can you send a letter to anyone if you do not know where he/she lives? This should explain the importance of an “IP address”.
An IP address is 32 (thirty two) bits in length, which can be divided into a network portion and a host portion with the help of a subnet mask. It is represented in form of four octets, where 1 octet = 8 bits. Each octet is converted to a decimal format and is separated by a dot (‘.’). For this reason, an IP address is said to be expressed in a ‘dotted decimal format’.
Examples of IP addresses in decimal format: 10.1.1.1, 255.255.255.255, 18.104.22.168
The value in each octet ranges from 0 to 255 in decimal format. The ‘dotted decimal format’ is used to make it easier for the humans to read and remember the numbers, but computers use IP addresses in a binary format only.
Example of an IP address in binary format: 10011101.11100010.10101110.11101000
Binary Octet to Decimal Format Conversion
There exist a well-defined method for converting binary IP addresses into its equivalent decimal format, and vice-versa. Humans prefer to operate on the dotted decimal format, whereas behind the curtain, computers deal with IP addresses in the binary form.
The right most bit, or the least significant bit, of an octet will hold a value of 20. The bit just to the left of it will have a value of 21. This series continues till the left-most 8 th bit which gets a value of 27 Hence, if all the binary bits of an octet are ‘1’, then the decimal equivalent would be 255.
|2 7||2 6||2 5||2 4||2 3||2 2||2 1||2 0|
11111111 (binary octet) = 1+2+4+8+16+32+64+128 = 255 (decimal format)
Given below is an example where all octet bits are not ‘1’.
|2 7||2 6||2 5||2 4||2 3||2 2||2 1||2 0|
01000001 (binary octet) = 1+0+0+0+0+0+64+0 = 65 (decimal format)
The IP Header
- Version : Current version of the IP addresses being used. The version can be either IPv4 or IPv6.
- Length : Total length of the IP header.
- TOS : TOS stands for Type of Service, which is used for the quality of service in high performance networks. This field establishes the way routers treat IP packets and prioritize them as they are queued to be sent.
- Size of Datagram : Total length of the IP header, and the data or the IP Packet. It is usually measured in bytes.
- Identification : An exclusive identification value assigned to the IP packet.
- Flags : Specifies if fragmentation should occur, i.e. the default flag indicates that fragmentation should not be performed.
- Fragmentation Offset : A byte count which provides segmentation and reassembly of large IP packets, bigger than the MTU.
- Time to Live : Number of hops/jumps which the IP packet can be routed over. This value is decremented with each hop an IP address makes.
- Protocol : Indicates the type of network protocol or an upper layer protocol. Such as, 23 = Telnet; 21= FTP; 6 = TCP; 17= UDP.
- Header Checksum : It is used to detect the processing errors introduced into the IP packet and to maintain the integrity of the data sent via the IP packet.
- Source Address: IP address of the original sender who transmits the IP packet.
- Destination Address : IP address of the last destination of the packet, for whom the IP packet was intended.
- Options : It is used for various reasons such as testing, security, etc. The option field is optional, but when used, the length of the IP header increases in size.
- Data : The actual data to be sent over the network.