Home > Articles > Cisco > CCNA Routing and Switching

Anatomy of an IPv4 Packet

One of the first subjects that a new networking student must learn is TCP/IP as it is used to connect together almost all modern devices. This article takes a look at the IPv4 packet, the fields that are defined within it and how they are used to transport the traffic from source to destination.
Like this article? We recommend

Like this article? We recommend

When beginning a career in computer networking, it is vital that the person entering the field is ready to learn and has a very open mind when it comes to new technologies and concepts. One of the first subjects that a new networking student must learn is TCP/IP, as it is used to connect together almost all modern devices. This article takes a look at the IPv4 packet, the fields that are defined within it and how they are used to transport the traffic from source to destination.

TCP/IP Version 4 Packet Structure

The TCP/IP Version 4 packet is composed of a number of different fields that can be used by the source and intermediary devices to determine the way a specific packet is treated when being transported. Figure 1 below shows the structure of the packet and the different fields that are contained within:

Figure 1 TCP/IP Version 4 Packet

As can be seen from the figure, there are a number of fields which have rather obvious names and some that do not. The following sections will explain the purpose of each of these fields and how they can be used to change forwarding behavior.

Version Field

The version field is one of the fields with a more obvious name and uses 4 bits. There are currently two versions of TCP/IP used in modern networks, Version 4 and Version 6. This article takes a look at the structure of the Version 4 header; when sending a Version 4 packet the value of the Version field will be 4 which is represented in binary as‘0100’.

Internet Header Length (IHL)

The IHL field is used to specify the total length of the header and is represented in 32 bit words. The minimum valid value for the IHL field is 5 (5 x 32 = 160 bits) which accounts for the Version, IHL, TOS, Length, Identification, Flags, Fragment Offset, TTL, Protocol, Checksum, and the Source and Destination Addresses, which are all mandatory.

Type of Service (TOS)/Differentiated Services Code Point (DSCP)[md]Explicit Congestion Notification (ECN)

When the Internet Protocol (IP) was initially designed this part of the packet header was called the Type of Service field that used 8 bits; this field was used to define a precedence value along with other quality of service (QoS) parameters for the packet. The modern implementation has changed from using this part of the packet from a single 8-bit TOS field to a 6-bit DSCP and 2-bit ECN fields. The DSCP field extends on the way that QoS is placed upon a specific packet; the specifics of the DSCP field could run the length of this entire article and is outside the scope of this article. The ECN field is used to provide end-to-end congestion notification between supporting ECN equipment.

Length

Unlike the IHL field, the Length field is used to indicate the total length of the IP packet including the data. This field is represented in octets (also referenced as bytes or 8 bits) and is provided a total of 16 bits in the header.

Identification

The Identification field uses 16 bits and is uniquely set by the sender to help identify specific packets when they are being reassembled from fragments. If there is only one packet and it is not fragmented then it will be the only packet with that specific identification value. For fragmented packets, the value is the same across all of the fragments and is used by the destination device to reassemble the data.

Flags

The Flags field is used to control how a specific IP packet is treated by a device. The field is 3 bits and is formatted as follows:

  • The first bit is always set to 0
  • The second bit represents whether a packet is allowed to be fragmented (Don’t Fragment[md]DF) or split into multiple pieces.
    • A value of 0 means that the packet is allowed to be fragmented
    • A value of 1 means that the packet is NOT allowed to be fragmented
  • The third bit represents the ‘location’ of a packet in a series of fragmented packets
    • A value of 0 means that the packet is the last fragment in a series OR a packet that is not fragmented at all
    • A value of 1 means that the packet is not the last fragment in a series and more fragments should be expected

Fragment Offset

The Fragment Offset field uses 13 bits and is represented in units of 8 octets (or bytes). This field is used to indicate to the destination device where a received fragment should be placed when all of the data from the packet is being reassembled. The Fragment Offset, along with the Identification field, is used to identify packets that have been fragmented and reassemble them in the correct order. Packets that are not fragmented AND the first packet in a series of fragmented packets will always have a fragment offset set to 0.

Time to Live (TTL)

The TTL field is used to limit the amount of time that a packet is allowed to exist on the “network”. The field uses 8 bits and is represented in seconds. Each device that receives a packet is required to decrement the TTL value by at least 1 regardless of whether the processing took less than a second; any device that decrements the value of the TTL field to 0 is required to drop the packet. Since almost all packets are processed in less than a second it is common for the value of the TTL field to be interpreted as maximum hops; for example, if a packet has a TTL of 3 and each device is required to decrement the TTL by at least 1 then the maximum number of devices that can process the packet is 3 before the packet must be dropped.

Protocol

The Protocol field uses 8 bits and indicates the next level protocol that is contained within the data portion of the packet. The most common values include the Transmission Control Protocol (TCP) with a value of 0x06 (hex) or 00000110 (binary), User Datagram Protocol (UDP) with a value of 0x11 (hex) or 00010001 (binary) and the Internet Control Message Protocol (ICMP) with a value of 0x01 (hex) or 00000001 (binary).

Checksum

The Checksum field uses 16 bits and is computed for only the packet header. Checksum provides a method of verifying that the header has not been corrupted when being transmitted from one device to another. To explain its function without going into the math, a checksum value is derived from the contents of the header at the source and is recomputed at the destination; if these values do not match, the packet will be discarded. Because the contents of the TTL field change from device to device, the checksum is recomputed at each device and reset in the header.

Source and Destination Address

Both the Source and Destination Address fields are 32 bits and indicate the source and destination IP addresses, respectively.

Options

The Options field is variable in length depending on the specific options that are being set; this field is optional. Most modern network traffic does not utilize the options field at all and because it is an optional field is not typically used.

Padding

The padding field is variable in length and is used when the Options field is used to ensure that the packet header ends at a 32 bit boundary.

Data

The data field inside a packet is variable in length and can contain any number of different protocols as defined by the developer. Common network traffic uses the TCP, UDP and ICMP protocols which will be contained within this part of the packet.

Summary

The processing of traffic from source to destination can be very confusing for those entering into the networking field. While most traffic uses basic parameters (no QoS, fragmentation or Options) it is possible for traffic to utilize a number of different complex features. The purpose of this article is to make the reader familiar with the fields contained within the IP packet and give a general overview as to how they are used. Hopefully the content of this article can give the reader a starting point when learning about IP and how it is used.

vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |