Search
Home Search Center IP Encyclopedia Online Courses Intelligent Model Selection

What Is IPv4?

IPv4, as the fourth version of the Internet Protocol (IP), serves as one of the widely used Internet protocols to provide the foundational framework for Internet communication.
IPv4 uses 32-bit IPv4 addresses to uniquely identify and locate devices, ensuring that data packets are correctly forwarded from one device to another. It provides basic network connection and communication capabilities for devices. However, the limited IPv4 address space has become a serious issue due to the rapid development of the Internet, leading to the emergence and growth of IPv6.

How Did IPv4 Come About?

IP, as the core protocol in the TCP/IP protocol suite, evolved alongside the development of computer networks. The first formal definition of IPv4 appeared in RFC 791 in 1981, which described the rules for allocating IP addresses and the packet switching mechanism of a network in detail. Additionally, several updated standards, including RFC 1349, RFC 2474, and RFC 6864, provided guidelines and regulations for differentiated services and fragmentation & reassembly of IPv4. As the Internet rapidly developed and underwent further commercialization, IPv4 gradually became a global standard protocol.
Development history of IPv4
Development history of IPv4

What Are the Core Technologies of IPv4?

The core technologies of IPv4 encompass address allocation rules, the IP packet format, the packet switching mechanism, and route selection. These technologies collectively enable IPv4 to effectively manage and allocate network addresses globally and route and transmit packets.

IPv4 Address

On an IP network, each host must have an IP address to identify its location on the network. Unlike physical addresses, IP addresses are logical identifiers. They can be dynamically allocated and modified as required. The key points are outlined below:

  • Hosts: serve as data terminals and communicate with other network nodes via IP addresses.
  • Network devices: act as transit nodes. Each interface has one or more IP addresses to forward host data on the network.

IPv4 address format

IPv4 uses a 32-bit binary number to represent an IP address. Theoretically, there are a maximum of 4.2 billion addresses in the entire IPv4 address space.

An IPv4 address can be written in any form that represents a 32-bit integer value. However, it is typically expressed in dotted notation for ease of reading and use. The following example shows how to express an IPv4 address in dotted decimal notation and dotted hexadecimal notation.
IPv4 address format example
IPv4 address format example

In dotted notation, zeros can also be omitted. For example, 192.168.000.001 in dotted decimal notation can be written as 192.168.0.1 or 192.168..1. 0xc0.0xa8.0x00.0x1 in dotted hexadecimal notation can be written as 0xc0.0xa8.0x0.0x1 or 0xc0.0xa8..0x1.

IPv4 address classification

An IPv4 address is divided into network and host bits. The network bits indicate the logical network area, while the host bits indicate the logical location of the host in the network segment. In the same network area, all hosts share the same network bits, whereas different network bits indicate varying network scales.

For example, in the phone number 001 907 1234567, 907 is the area code for Alaska, USA. This is similar to the network bits in an IP address. 1234567 is the number of a specific telephone in Alaska, USA. This is similar to the host bits of an IP address.

When an IP packet is transmitted on a network, a router determines its path based on the network bits of the destination IP address. Once the packet arrives at the destination network segment, the last-hop router identifies the specific receiving host using the host bits of the destination IP address.

IPv4 addresses are partitioned into three primary classes by network scale: Class A, Class B, and Class C. In addition, Class D addresses are defined for multicast addressing and Class E addresses are reserved for future use. The five address classes are determined by the most significant bits of the first byte in an IPv4 address.
IPv4 address classification
IPv4 address classification
Some primary network addresses serve as private addresses and therefore cannot be used on the Internet. These addresses are used on LANs of enterprises or organizations. Utilizing private addresses for LAN hosts helps conserve public IP addresses. These private addresses are also commonly referred to as fake addresses. In contrast, IP addresses that can be used directly on the Internet are known as public or real addresses.
Range of five classes of IPv4 addresses
Range of five classes of IPv4 addresses

The concept of IP address classes in IPv4 is rooted in its early design. However, practical IPv4 address allocation has undergone significant adjustments and optimizations due to the limited address space and the issue of address exhaustion. For instance, subnet masks are used for more refined network division and address allocation.

Subnet mask

A subnet mask is a 32-bit binary number used to divide network and host portions in an IPv4 address. It is used together with an IP address to form an IP network address, which is represented in the form of IP address/subnet mask (for example, 192.168.1.1/255.255.255.192).
Subnetting example
Subnetting example

By using subnet masks flexibly, you can divide a large network into multiple subnets for effective management and control of network traffic and security. Classless inter-domain routing (CIDR) offers a flexible approach to IP address allocation and route selection. It dynamically allocates subnet mask bits as required, optimizing IP address utilization. The CIDR notation can be used to indicate an IP address range with its corresponding subnet mask bits. For example, 192.168.1.1/26 indicates that the IP address range is 192.168.1.0 to 192.168.1.63 and the subnet mask is 255.255.255.192.

IPv4 Packet Format

The services provided by the IP layer are implemented by encapsulating and decapsulating packets. An IPv4 packet consists of a header area and a data area.

The forwarding control of an IPv4 packet is determined by the IP header, which consists of two parts. The first part has a fixed length of 20 bytes and is mandatory, and the second part contains some optional fields with variable lengths. The following describes the fields in the IP header in detail.

IP header format
IP header format
Table 1-1 Fields in the IP header

Field

Length

Description

Version

4 bits

IHL

4 bits

Header length. If the Option field is not carried, the value is 20. The maximum value is 60, which limits the Record Route option. The unit is 4 bytes.

Type of Service

8 bits

This field takes effect only when QoS differentiated services are required.

Total Length

16 bits

Total length of the entire IP packet, in bytes. The value contains the lengths of the header and data. The maximum value is 65535. The total length must be less than or equal to the maximum transmission unit (MTU).

Identification

16 bits

This field is used during fragmentation and reassembly. The value is incremented by 1 each time a host sends a packet.

Flags

3 bits

The format of this field is as follows:

Format of the Flags field
Format of the Flags field
  • Bit 0: reserved. The value must be 0.
  • Bit 1: DF. The value 0 indicates "May Fragment," and the value 1 indicates "Don't Fragment."
  • Bit 2: MF. The value 0 indicates "Last Fragment," and the value 1 indicates "More Fragments."

Fragment Offset

13 bits

Position of a fragment in the original packet. This field is used during fragmentation and reassembly. The offset unit is 8 bytes.

Time to Live

8 bits

Maximum time the packet is allowed to be on the network.

Protocol

8 bits

Next-level protocol used in the data portion of the packet. The IP layer of the destination host can send the data portion to the process corresponding to this protocol.

Header Checksum

16 bits

Only the packet header undergoes verification, while the data portion remains unchecked. Unlike using cyclic redundancy check (CRC) codes, a straightforward calculation method is employed.

Source Address

32 bits

Source IP address.

Destination Address

32 bits

Destination IP address.

Options

Variable

This field supports various options, such as error correction, measurement, and security. Its length ranges from 1 byte to 40 bytes, depending on the function of the option.

Padding

Variable

This field is set to all 0s.

Packet Fragmentation and Reassembly

In the IP/TCP model, IP is located at the network layer. IP packets are sent and received based on services provided by the link layer. If an IP packet's length exceeds the MTU at the link layer, it must be fragmented for transmission. When fragments are transmitted to the receiver through the network, the receiver reassembles them into the original packet. The IPv4 packet fragmentation and reassembly process is as follows:

  • Fragmentation
    1. The sender checks the length of a packet to be sent based on the MTU of the target host.
    2. If its length exceeds the MTU, the sender divides it into fragments. The size of each fragment cannot exceed the MTU.
    3. Each fragment is an independent IP packet, and they share the same IP header information (except for the Fragment Offset and Flags fields).
  • Reassembly
    1. After receiving these fragments, the receiver determines how to assemble them based on the Identification, Fragment Offset, and Flags fields of each fragment.
    2. The receiver reassembles all fragments into the original IP packet.
    3. The complete packet is transmitted to an upper-layer protocol for processing.

For example, if the total length of an IP packet is 4020 bytes (20 bytes for the IP header and 4000 bytes for the data area), it needs to be fragmented before being sent through the link layer with an MTU of 1500 bytes. Since the length of the IP header is 20 bytes, the length of each fragment's data area cannot exceed 1480 bytes. Consequently, the original IP packet can be divided into three fragments, and the lengths of their data areas are 1480 bytes, 1480 bytes, and 1040 bytes, respectively. Except for the Flags and Fragment Offset fields, the IP header information of the fragments is the same as that of the original IP packet.

IPv4 packet fragmentation example
IPv4 packet fragmentation example

What Are the Limitations of IPv4?

IP technologies have found widespread application due to the immense success of the IPv4-based Internet. However, as the Internet evolves, the weaknesses of IPv4 have become increasingly apparent in the following aspects:

  • The IPv4 address space is insufficient.

    IPv4 addresses are 32 bits long, theoretically providing 4.3 billion IPv4 addresses. However, the number of IPv4 addresses that are actually available cannot reach such a value due to various address allocation reasons. Additionally, IPv4 address resources are unevenly allocated. IPv4 addresses in the USA account for almost half of all addresses, leaving insufficient addresses for Europe and even fewer for the Asia-Pacific region. The shortage of IPv4 addresses limits further development of mobile IP and broadband technologies that require an increasing number of IP addresses.

  • A large number of routing entries on devices need to be maintained.

    Many non-contiguous IPv4 addresses are allocated. Routes cannot be summarized effectively due to incorrect IPv4 address allocation and planning. The increasing size of the routing table significantly impacts memory resources and hampers forwarding efficiency. Device vendors must continually upgrade devices to improve route addressing and forwarding performance.

  • Address autoconfiguration and readdressing cannot be easily performed.

    IPv4 addresses are only 32 bits in length and are allocated unevenly. Consequently, IPv4 addresses need to be reallocated during network expansion or replanning, increasing maintenance workload.

  • Security cannot be guaranteed.

    As the Internet evolves, security concerns have grown more pronounced. Unfortunately, IPv4's initial design did not adequately address security, resulting in an original framework that cannot guarantee end-to-end security.

The limitations of IPv4 directly prompted the industry to hasten the development and promotion of IPv6, providing a broader and sustainable basis for future Internet growth and innovation.

For more information about IPv6, see What Is IPv6?.

About This Topic
  • Author: Zhu Xiaoping
  • Updated on: 2024-12-17
  • Views: 5069
  • Average rating:
Share link to