Overview

IP (Internet Protocol) is a data transfer protocol that allows data to be transmitted from one host to another no matter how far apart they are physically. This section explains the data transfer mechanism of IP and the IPv4 header format that makes it possible.

What is IP?

IP (Internet Protocol), as included in the name TCP/IP, is a very important protocol among the various protocols of TCP/IP. The basic specification of IPv4 is defined in RFC 791.

First, let’s clarify the role of IP.

The role of IP is to “transfer data from one host to another on the network. This is also described as “end-to-end communication”.

Figure: Role of IP
Figure: Role of IP

The term “host” refers to all devices that use TCP/IP. Specifically, PCs, smartphones, servers, routers, Layer 3 switches, and other network devices are “hosts”. The source and destination hosts can be on the same or different networks. If you are viewing this web page, you have just transferred data over IP.

Data transfer over IP

To transfer data over IP, an IP header is added to the data to be transferred, making it an “IP packet. Then, simply send the IP packet out to the network.

If the destination is connected to a different network, there is a router or Layer 3 switch in between. IP packets sent from the source host are forwarded by the routers on the route to the final destination host. The term “routing” refers to the forwarding of IP packets by routers.

Figure: end-to-end communication over IP
Figure: end-to-end communication over IP

But IP alone is not enough

However, IP alone does not result in data reaching the desired destination. This is because IP does not have the ability to convert “0” and “1” data into physical signals such as electrical signals or radio waves. Make sure you understand this properly.

Further network interface layer protocols such as Ethernet and Wi-Fi are required to send IP packets out over the network. Ethernet/Wi-Fi is a protocol for sending and receiving “0” and “1” data as physical signals such as electrical signals and radio waves.

IP packets are further encapsulated in a header of a network interface layer protocol such as Ethernet/Wi-Fi, converted into a physical signal, and sent out over the network.

Figure: IP and Ethernet/Wi-Fi
Figure: IP and Ethernet/Wi-Fi

For IP, the data is most often a transport layer protocol such as “TCP” or “UDP”. And for TCP and UDP, the data is application protocols such as HTTP.

IPv4 and IPv6 share the same basic role of “end-to-end communication”, and it is very important to understand the role and structure of IPv4 in order to understand IPv6.

Image of data transfer over IP

Encapsulating and forwarding data with an IP header is an image of creating a virtual tunnel between the destination and the source. There are a vast number of hosts on the network, especially on the Internet. But data is not forwarded to unrelated destinations. This is because it is only forwarded to the host with the destination IP address. The router/Layer 3 switch routes so that this happens.

Figure: IP forwarding creates a virtual tunnel
Figure: IP forwarding creates a virtual tunnel

However, IP virtual tunnels are not created in advance. It is created as a result of forwarding based on an IP header by a router or Layer 3 switch on the route. This feature of IP is a connectionless forwarding protocol. The route along the way is not fixed and can change.

The virtual tunnels created by these IPs are unidirectional. Separate IP tunnels can be created for data going and returning.

IPv4 Header Format

The format of the IPv4 header to be added to transfer data over IP is as follows

Figure: IPv4 Header Format
Figure: IPv4 Header Format

Version

The “Version” field contains the exact version of the IP. The current version of the IP is “4”. And the next version of IP is “6”. The next version after “version 4” is “6” skipping “5”. Version 5 is already used for experimental purposes, so the next version after “4” is “6”.

Internet Header Length

The “Internet Header Length(IHL)” contains the length of the IP header. However, it is not the actual length, but rather the length in 4-byte units. In other words, the standard IP header is 20 bytes, so the IHL is “5”.

Type of Service

The “Type of Service(ToS)” is used for Quality of Service (QoS) control. QoS is mainly a control for network devices such as routers and switches to transfer data according to priority. Data can be grouped by “Type of Service” according to priority of IP packets.

Total Length

In “Total length”, the length of the entire IP packet including headers comes in. If you want to know the length of the raw data, you can find it in “Total Length” – “Internet Header Length”.

Identification/Flags/Fragment Offset

The “Identification”/”Flags”/”Fragment Offset” are information related to the segmentation and assembly of data.

Today, however, data is not often segmented or assembled over IP; it is more often segmented over TCP, the protocol above IP, so that segmentation over IP does not occur.

TTL(Time To Live)

“TTL” stands for Time To Live, and is a measure of packet survival time. The “TTL” is actually “How many routers can a packet pass through? TTL is intended to prevent IP packets from looping endlessly through the network due to inconsistencies in the router’s routing table.

The TTL is decremented by 1 each time the packet passes through the router, and when the TTL reaches 0, the router discards the IP packet.

Protocol

The “Protocol” is a number that identifies what the upper-level protocol is. There are two protocols, TCP and UDP, in the upper transport layer of IP, and the “Protocol” identifies which one to pass the data to. Protocols such as ICMP, OSPF, IGRP, and EIGRP included in the Internet layer are also carried as IP packets with IP headers added. In other words, the “Protocol” identifies what protocol the data carried over IP is from.

The main “Protocol” numbers are listed in the table below.

“Protocol” numberProtocol
6 TCP
17 UDP
1 ICMP
89 OSPF
88 EIGRP
表 主なプロトコル番号

Note that the “Protocol” number may also represent the next header after the IP header. An IP header is added to the data to make it an IP packet, and various protocol headers are added to the data for IP. The “Protocol” number tells you what protocol the next header in the IP header is for.

Figure: Meaning of "Protocol" Number
Figure: Meaning of “Protocol” Number

Header Checksum

The “Header Checksum” is a field used to verify that the IP header is free of errors.

Source address/Destination Address

Specify the source and destination IP addresses in this field. The source IP address is always unicast address. Broadcast or multicast addresses are never entered into the source IP address field.

Options/Padding

The “Options” were used for a variety of purposes to experiment with IP, but are now rarely used and can be safely assumed to have no IP header options.

“Padding” is used to adjust the size of the IP header. When an option is added, padding is added so that the size of the IP header is a multiple of 4 bytes (32 bits). Since options are rarely added, padding is rarely added.

The important field of the IP header is the IP address.

For end-to-end communication, the most important information in the IP header is the destination/source IP address; remember that when communicating over TCP/IP, the IP address is always specified.

However, users are not made aware that they are specifying an IP address, since IP addresses are a series of numbers that are difficult for users to understand; web browsers and e-mail software do not require users to specify a destination IP address. However, an IP address is always required.

DNS is used to allow users to specify IP addresses without making them aware of the IP address. DNS is also a very important protocol that supports TCP/IP communication.

Summary

Points

  • IP allows data to be transferred from one host to another. All you need to do is send out an “IP packet” with an IP header appended to the data you want to transfer over the network.
  • But IP alone is not enough. It is combined with Ethernet/Wi-Fi, etc. to send out on the network, i.e., to make “0” and “1” a physical signal.
  • The most important information in the IP header is the IP address; an IP address is always required to transfer data over IP.