CN
CN
The IPv4 header consists of 12 fields, which are organized in the following
manner
Version (4 bits): This field specifies the version of the IP protocol being used,
which is IPv4 in this case.
Header Length (4 bits): The header length field indicates the length of the IPv4
header in 32-bit words. Since the header is a fixed size of 20 bytes, the value of
this field is typically 5.
Type of Service (8 bits): This field is used to define the quality of service (QoS) for
the packet, including priorities and other parameters for routing and processing.
Total Length (16 bits): The total length field specifies the length of the entire IPv4
packet, including both the header and the data, in bytes.
Identification (16 bits): The identification field is used for packet fragmentation
and reassembly. It helps in grouping fragments of a larger packet together.
Flags (3 bits): These bits are used for controlling and identifying packet
fragmentation. The flags include the "Don't Fragment" (DF) and "More
Fragments" (MF) flags.
Fragment Offset (13 bits): The fragment offset field specifies the position of the
fragment within the original packet. It is used to reassemble fragmented packets
correctly.
Time to Live (TTL) (8 bits): The TTL field represents the maximum number of
hops (routers or network segments) that the packet can traverse before it is
discarded. Each router decrements this value by one.
Protocol (8 bits): This field indicates the type of protocol used in the data portion
of the packet, such as TCP, UDP, ICMP, or others.
Header Checksum (16 bits): The header checksum field is used to verify the
integrity of the IPv4 header during transmission. Routers and devices recalculate
this checksum to check for errors.
Source IP Address (32 bits): This field contains the IP address of the sender or
source of the packet.
Destination IP Address (32 bits): This field holds the IP address of the recipient or
destination of the packet.
TCP
Source Port It is a 16-bit source port number used by the receiver to reply.
Destination PortIt is a 16-bit destination port number.
Sequence Number-The sequence number of the first data byte in this segment.
During the SYN Control bit is set, and the sequence number is n, and the first
data byte is n + 1.
Acknowledgement Number-If the ACK control bit is set, this field contains the
next number that the receiver expects to receive.
Data Offset-The several 32-bit words in the TCP header shows from where the
user data begins.
Reserved (6 bit) It is reserved for future use.
URG It indicates an urgent pointer field that data type is urgent or not.
ACK It indicates that the acknowledgement field in a segment is significant, as
discussed early.
PUSH The PUSH flag is set or reset according to a data type that is sent
immediately or not.
RST It Resets the connection.
SYN It synchronizes the sequence number.
FIN This indicates no more data from the sender.
Window It is used in Acknowledgement segment. It specifies the number of data
bytes, beginning with the one indicated in the acknowledgement number field
that the receiver is ready to accept.
Checksum It is used for error detection.
IPV6
The size of this field is 4-bit. Indicates the version of the Internet Protocol, which
is always 6 for IPv6, so the bit sequence is 0110.
Traffic Class(8-bit) The Traffic Class field indicates class or priority of IPv6 packet
which is similar to Service Field in IPv4 packet. It helps routers to handle the
traffic based on the priority of the packet. If congestion occurs on the router then
packets with the least priority will be discarded.
Flow Label (20-bits) Flow Label field is used by a source to label the packets
belonging to the same flow in order to request special handling by intermediate
IPv6 routers, such as non-default quality-of-service or real-time service. In order
to distinguish the flow, an intermediate router can use the source address, a
destination address, and flow label of the packets. Between a source and
destination, multiple flows may exist because many processes might be running
at the same time. Routers or Host that does not support the functionality of flow
label field and for default router handling, flow label field is set to 0. While setting
up the flow label, the source is also supposed to specify the lifetime of the flow.
Payload Length (16-bits) It is a 16-bit (unsigned integer) field, indicates the total
size of the payload which tells routers about the amount of information a
particular packet contains in its payload. The payload Length field includes
extension headers(if any) and an upper-layer packet. In case the length of the
payload is greater than 65,535 bytes (payload up to 65,535 bytes can be
indicated with 16-bits), then the payload length field will be set to 0 and the
jumbo payload option is used in the Hop-by-Hop options extension header.
Next Header (8-bits) Next Header indicates the type of extension header(if
present) immediately following the IPv6 header. Whereas In some cases it
indicates the protocols contained within upper-layer packets, such as TCP, UDP.
Hop Limit (8-bits) Hop Limit field is the same as TTL in IPv4 packets. It indicates
the maximum number of intermediate nodes IPv6 packet is allowed to travel. Its
value gets decremented by one, by each node that forwards the packet and the
packet is discarded if the value decrements to 0. This is used to discard the
packets that are stuck in an infinite loop because of some routing error.
Source Address (128-bits) Source Address is the 128-bit IPv6 address of the
original source of the packet.
Destination Address (128-bits) The destination Address field indicates the IPv6
address of the final destination(in most cases). All the intermediate nodes can
use this information in order to correctly route the packet.
Extension Headers In order to rectify the limitations of the IPv4 Option Field,
Extension Headers are introduced in IP version 6. The extension header
mechanism is a very important part of the IPv6 architecture. The next Header
field of IPv6 fixed header points to the first Extension Header and this first
extension header points to the second extension header and so on.