Headers And IP Message Formats
WHAT IS TCP HEADER?
We know that you are interested in learning about the different message formats that we use in our regular. Below, we have summarized the most common formats and provided a link to more information.
Before Preceding Further reading About Headers, one should be aware of Working of web.
TCP in short Transmission Control Protocol basically is used to transport data over the internet, and it is a transport layer protocol that has been designed to send data packets over the internet and establishes a reliable end-to-end connection.
- It basically delivers data packets to their desired destination without any error
- It also controls and handles congestion and flow but controls window size
- In TCP sequence numbers are used to that which data has a been transmitted and received
- It is in full duplex mode.
- TCP divides the data which is received into data chunks and each is a collection of bytes.
- TCP segment =TCP header + Data chunk.
So, lets take a look at the elements of the TCP header: –
- Source Port number– as the name suggests, it is a 16-bit field that specifies the sender device port number.
- Destination Port Number: – so, the destination port number suggests the port number of the receiver.
- Sequence numbers-a Sequence number is a 32-bit field that shows how much data is transferred or sent during a session. Also, when we create a three-way handshake, the first syn is a 32-bit value and the receiver uses the sequence number and then sends an acknowledgment. It is basically used for marking the ordering of data.
- Acknowledgment number- It is a 32-bit field used by both sender and receiver to request the next TCP segment, then this will be incremented by 1 sequence number (i.e., the sequence number of the last received data byte +1).
- Data offset – Also called header length, it is 4 bits, and it defines the length of the TCP header so that we can see where the actual data begins.
The length of the TCP header always lies in the range- [20 bytes, 60 bytes]
- Reserved- From the name, we can say that there are bits and they are unused ones and reserved.
- TCP flags-So basically there are 9 bits for flags as they allow to establish a connection, send data, and terminate it. It uses on or off to manage the data flow.
- URG-urgent pointer, when this flag is set to 1 then it shows that some amount of data in the segment is urgent and has to be prioritized, also treated as a priority.
- ACK-it is basically for acknowledgment, when it is set to 1 then it represents that the ack number present in the TCP header is valid. Also, a request segment is sent to establish a connection.
- PSH-In this all the segments in the buffer and need to wait for the entire filling and it also makes the entire buffer free immediately.
- RST- this is mainly used to reset connection and when we receive it this immediately terminates the connection it results in loss of data and transfer of data ceases in both directions.
- SYN-It is used to initialize the three-way connection or establish the connection.
- FIN-It is used to terminate the connection. As TCP uses full duplex so both users had to use FIN to end the connection.
- Window- It is a 16-bit field. it specifies how many bytes of data the sender can receive without ACK. Also, more data can be transferred by specifying the 16-bit number of bytes beyond the sequence number.
- Checksum- it is 16-bit and only used to define the integrity of data in payload and also to check whether the TCP header is ok or not.
- Urgent pointer-It is 16 bit it is only used when URG BIT has been set and is also here to check whether urgent data ends.
- Options-It is optional and can be found anywhere also it supports special acknowledgment.
WHAT IS IPV4?
Basically IPv 4 in short version 4 of Ip i.e internet protocol. It is used to deliver data packets from the source host and destination host and also the first version or we can say a major version of IP.
Addition:-Basically an IP datagram is the format of data that can be recognized by ip and it has a header and data.
- Version- This always tells which version we are using and so we are using version 4 so always we will tend to find 4 values.
- IHL-Also called Internet header length and this is used to define the header length in 32-bit increments. It would be a header length of 60 bits.
Header length = header length field value * 4 bytes value
- DS Field- It is used to define the quality of service. it is an 8-bit which is used to give a datagram treatment to this field.
- ECN- It stands for explicit network congestion. It prevents packets from dropping and also allows end-to-end network congestion.
- Total length-It shows the total length of the datagram and basically shows the entire size of ip packet which is 20 bytes as the minimum.
- Identification-Here identification means that it is used to identify the original IP datagram basically in simple language it is used to identify to which IP packet they belong. A fragment datagram is provided with the same identified number and used to resemble the fragments.
- Flags-Here Flags use 3 bits for fragmentation:
The First states that it is always set to 0
The second states Don’t fragment bits which means that this packet should not be fragmented.
The third one i.e More fragments mean to set on all fragments packets except or leave the last one.
- Fragment Offset- IT BASICALLY SHOWS THE POSITION OF THE FRAGMENTED DATAGRAM IN THE UNFRAGMENTED FORM OR RAW ONE.
- Time to live-it is used to prevent the IP datagrams from looping in the routing loop and also shows the no. of hops that a datagram takes to reach the destination and when it is set to 0 it means the datagram is discarded.
- Protocol-So here protocol means that it tells the layer which is the network layer at the destination to state which IP datagram belongs to Also we can say it describes the next level protocol
- Header checksum- It is basically a 16-bit field where it is used to identify if there are any errors in the header and the user can also check it. Basically, it is used for error checking in the header.
- Source Address-Similarly, here it has the logical 32-bit field of the sender.Similarly,
- Destination Address-it is the 32-bit one and contains the logical address of the receiver.
- Ipv4 options-It is primarily not used or often used and this is optional its main aim is that when we use this it will lead to an increase in the header length field increase.
- Padding- it only makes sure that the IP packet header should have a length that is in the form of 32 bits.
WHAT IS IPv6 Header?
- Version(4 bits)- so basically it shows the version of the protocol and the bit sequence is 0110.
- Traffic class- Here it is similar to IPv4 quality service as it provides class or priority to IPv6, So here these 8 bits are further divided into 6 which are the most significant and define what type of service should be provided and the least 2-bit or remaining work as ECN.
- Flow labels-It means that it requires special handling by IPv6 routers and this contains the specific sequence of packets between source and destination. For default handling, it is set to 0.
- Payload Length-It basically used to determine the amount of information and data in the packet in the payload which is also used to define the size of the payload and it contains the extension header and upper-layer PDU.
- Next header-It is basically used to indicate whether the first will be the extension header or it is the PDU one.
- Hop limit-It is similar to TTL which is there in IPv4 to explain Hop limit states that it prevents the packet to loop in a network indefinitely and also states that the maximum number of nodes or links the IPv 6 can travel and when it is set to 0 then it is discarded.
- Source address- It is similar in all headers which state the originator address.
- Destination address-And this one is the receiver address or recipient of the packet.
So Further Here is the PDU and extension header.
It stands for “protocol data unit” which refers to the group of information which is added or removed in the OSI layer. Also in every layer, it is defined as a different element like:-
Layer 1-PDU is a bit.
Layer2-here it is a frame.
Layer 3- here it is a packet.
Layer 4- and segment.
Aso above the 5th layer including the 5th also it is called data.
So Here this is the new type of concept which is developed in IPv6 and is rarely used in IP, here a new field extension header is added which states that to add optional headers. It allows developers to define new options without modifying the IPv6. Also, These are added between the base header and transport layer. In addition, all the headers point to the next one in an inking manner.
|Hop-by-Hop options||Examined by all devices on the path|
|Routing Header||Method to take a routing decision|
|Fragment header||Contains parameter of fragmented datagram done by source|
|Destination options Header||Examined by destination of the packet|
|Authentication Header||It used to verify the authenticity|
|Encapsulating Security Payload Header||It carries Encrypted Data.|
The correct way or sequence of extension headers is:-
WHAT IS ICMP HEADER?
It stands for Internet Control Message Protocol. It is a part of network layer protocol and used in network and diagnostics also generally used in network devices called routers. It is mainly used for error handling in the network layer.
It increases the chances of effective packet delivery and enables hosts and devices to report errors.
- Type -It is an 8-bit field that generally defines the message type of ICMP. Generally, 0 to 127 are considered ICMPv6, and 128 to 255 are data messages.
- Code-It basically generalizes the subtype of ICMP message, also what is its kind.
- Checksum-It checks whether there is an error in the message or not and basically, it is used to see if the ICMP header is corrupt or not.
It stands for user datagram protocol. It is a transport layer protocol and is a part of the internet protocol suite. In this, there is no need to establish any connection for data transfer. Here the checksum calculation is not compulsory as it was in TCP.
- Source port- Same it is used to identify the source port of the packet or basically the port of sending the application.
- Destination Port-Here it is the destination port of the one receiving the application.
- Length-It is used to define the length of UDP including the IP header and the data it contains.
- Checksum-In IPV4 this field is optional, so here it stores the checksum value generated by the sender before sending it and its calculation is not necessary for UDP. Also, the size of the UDP header is fixed. And provides some limited services.
If you have any questions about any of these formats, please feel free to contact us. Thank you for your interest!!