Frame || IP Packet || TCP format:
Frame Format:
Frame format is two types. Works are same. Only format is different for both. It is payload data unit of layer 2.
1)Ethernet format: When layer 3 protocol are present like EIGRP, BGP etc.
Please find the below field details:
Preamble (7 byte): synchronize between physical layer and data link layer. Bits are coming from physical layer in alternative patterns 10101… continuously. It is allowed to lock the bits steaming before initiate the frame.
SFD (1 Byte): It is 10101011 patterns. last 11 is indicating of start of frame.
Source Address (6 byte): It is Mac address of sender.
Destination Address (6 byte): It is Mac address of receiver.
Length (2 bytes): Length of frame header + length of payload (Which would not be more than 1500 byte).
FCS (4 bytes)/Tails: It is used to check payload integrity after receiving at destination.
2)IEEE 802.3 format: It is for layer 2 protocol like STP, CDP etc.
Please find the below field details:
SFD (8 Byte): Bits are come from physical layer in 101010….11 in alternative pattern. Last 2 bits are 11 which indicates starting for actual frame.
Source Address (6 byte): It is Mac address of sender.
Destination Address (6 byte): It is Mac address of receiver.
Type (2 bytes): Protocol number of upper layer from where payload has been received and to which protocol where will hand over the payload in upper layer.
FCS (4 bytes)/Tails: It is used to check payload integrity.
IP Packet Format:
It is payload data unit of layer 3. It is can be vary withing 20 byte to 60 bytes. Not more than or not less than.
Please find the below field details:
Version (4 bit): Version of logical IP addressing. It is two types: 1) IPV4(32 bits), 2) IPV6(128 bits).
Type of service (4 bits): priority packets will send before.
HLEN (4bits): Header length of packet without payload. (Row number of packet X 4).
Total length (16 bits): Total entire length of packet (Header +payload).
Identification number (16 bits): numbering of fragments in series wise. While reach at destination, It will rearrange by this number.
Flags (3 bits): 0à Reserved, 1à No fragment, 2à More fragment.
Fragment offset (16 bit): Indicates how much data has gone with before the fragment and from where data will start with this fragment.
TTL (8 bit): It is decreased one by one during transmission one hop to another. Cisco->255, Linux -> 64, Window-> 128 etc.
Protocol (8 bits): Protocol number of upper layer.
Header checksum (16 bits): check data integrity.
Source IP address (32 Bits): IP Address of sender.
Destination IP address (32 Bits): IP address of receiver.
Option: It is optional.
Payload: Data from upper layer.
TCP format:
It is payload data unit of Layer 4. It is can be vary withing 20 byte to 60 bytes. Not more than or not less than.
Please find the below field details:
Source port number (16 bits): Service port number of sender.
Destination port number (16 bits): Service port number of receiver.
Sequence number (32 bits): Initial sequence number is always zero. Then increase number with every data byte to ensure that all data has been received in proper manner.
Acknowledgement number (32 bits): It is confirmed to sender that data has been received at destination by adding one number with sequence number and also indicate next upcoming packet.
Data Offset (4 bits): Size of TCP header.
Reserved (3 bits): Reserved for future.
Flags (9 bits):
SYN :
Initiate the connection from sender side.
ACK:
Feedback from receiver to sender that data has been successfully received at destination end.
PSH:
store in TCP buffer, when path available, send to destination and store in TCP buffer.
URG:
Not store in TCP buffer, directly send to destination.
RST:
Forcefully abort the connection.
FIN:
Gracefully terminate the connection.
Window size (16 bits): How much data can receive for sender and receiver end. It is used for flow control as capacity of acceptance of data byte can different for sender and receiver.
Urgent pointer (16 bits): Indicate the urgency if required.
Header checksum (16 bits): Check the data integrity at destination end.
Option (padding): This is optional.
Payload: Actual data.