1. Format of Ethernet Frames
Ethernet Package Format
2.IP Header Format
IP is the most important protocol in the TCP/IP protocol cluster. All TCP,UDP, ICMP, and IGMP data are transmitted in an IP datagram format. IP provides an unreliable, non-connected protocol.
The general IP header is 20 bytes unless it contains an option field.
4-bit version : The current protocol version number is 4, so IP is sometimes referred to as IPV4.
4 Heads of Ministers : the first length refers to the number of 32bit words, including any options. Since it is a 4-bit field, the header length is a maximum of 60 bytes.
service Type (TOS): The Service Type field includes a 3bit priority field (which is now ignored), the TOS subfield for 4bit, and the 1bit unused bit must be set to 0. The TOS for 4bit represent: Minimum delay, maximum throughput, maximum reliability and minimum cost. Only 1 bits can be placed in 4bit. If all 4bit is 0, then it means General Service.
Total Length: The total Length field refers to the length of the entire IP datagram, in bytes. With the first ministerial and total length fields, you can know the starting position and the length of the data content in the IP datagram. Because of the length of the word 16bit, the IP datagram can be up to 65535 bytes long. When the datagram is fragmented, the value of the field changes as well.
identity Field : The Identity field uniquely identifies each datagram sent by the host. It usually adds 1 to the value of each message sent.
time to live : T t L (time-to-live) The time-to-live field sets the maximum number of routers that datagrams can pass through. It specifies the time-to-live of the datagram. The initial value of T T L is set by the source host (typically 3 2 or 6 4), and once it passes through a router that handles it, its value is subtracted by 1. When the value of this field is 0 o'clock, the datagram is discarded and an I C M p message is sent to notify the source host.
First Inspection and: the first Test and the field is based on the first calculation of the test and code. It does not calculate the data behind the header. I C M P,
The I G M p, U D p and t C p all contain both header and data inspection and code in their respective headers.
3.TCP Header Format
Although t C p and U D p all use the same network layer (I p), T C P provides services to the application layer that are completely different from the U D p. T C P provides a connection-oriented, reliable byte-stream service.
If the optional field is not counted, it is usually 2 0 bytes.
Source port number and destination port number : Used to find the originating and receiving application processes. These two values plus the I p header in the source-side I p address and the destination I p address uniquely determine a T-C-P connection.
ordinal field: The ordinal is used to identify the data byte stream that is sent from the T-C p originator to the T-C P-Receiver, which represents the first data bytes in the message segment. If you consider a byte stream as a one-way flow between two applications, T C p counts each of the bytes with an ordinal number. The serial number is the unsigned number of the 232-1 bit and starts at 0 after the sequence number is reached.
When a new connection is established, the SYN flag becomes 1. The ordinal field contains the initial ordinal number of the connection selected by this host (Initial Sequence numbers). The first byte ordinal of the host to send data is this isn plus 1, because the SYN flag consumes an ordinal number (the next chapter details how to set up and terminate the connection, when we will see that the F I N flag also takes a sequence number)
Confirm Sequence Number : Since each transmitted byte is counted, the confirmation sequence contains the next ordinal that is expected to be received at the end of the sending acknowledgment. Therefore, the confirmation sequence number should be the last time the data byte sequence number plus 1 has been successfully received. Only the ACK flag (described below) is 1 o'clock to confirm that the ordinal field is valid. The ACK does not have to be sent at any cost, since the confirmation Sequence Number field is the same as the A C K flag, which is always the T C P header
Part. Therefore, we see that once a connection is established, this field is always set and the ACK flag is always set to 1. TCP provides full duplex service for the application layer. This means that the data can be transmitted independently in two directions. Therefore, each end of the connection must maintain the serial number of the transmitted data in each direction.
Capital Length : The number of the first length to the first. This value is required because the length of the optional field is variable. This field accounts for 4 bits, so T C P has a maximum of 6 0 byte headers. However, there is no optional field, and the normal length is 2 0 bytes.
flag Field : There are 6 flag bits in the T-C p header. Multiple of them can be set to 1 at the same time.
The Urg emergency pointer (u rgent pointer) is effective (see 2 0. Section 8).
ACK Confirmation number is valid.
PSH receiver should hand over this segment to the application layer as soon as possible.
RST rebuilds the connection.
The SYN synchronous sequence number is used to initiate a connection. This symbol and the next mark will be introduced in 1th 8.
Fin originator completes the send task.
window size : The flow control of T C P is provided by the window size declared by each end of the connection. The window size is the number of bytes, starting with the value indicated in the confirmation ordinal field, which is the byte that receives the correct expected receive. The window size is a single-bit field, so the maximum window size is 65535 bytes.
Inspection and: test and cover the entire T C P segment: T C P header and T C P data. This is a mandatory field that must be computed and stored by the originator and validated by the end of the collection.
Emergency hands : only if the URG flag is placed 1 o'clock the emergency pointer is valid. The emergency pointer is a positive offset, and the sum of the values in the Ordinal field represents the ordinal of the last byte of the emergency data. The emergency mode of T C P is a way of sending an emergency data to the other end.
option : The most common optional field is the longest message size, also known as MSS (Maximum Segment size). Each connector typically indicates this option in the first message segment of the communication (the segment that sets the S Y-n flag for the connection setting). It indicates the maximum length of the message segment that can be received on this side.
4. UDP header
UDP is a simple transport-layer protocol for datagrams: Each output of a process produces exactly one UDP datagram and is assembled into a single I-p datagram to be sent. This is different from a stream character-oriented protocol, such as T C p, where the entire data generated by the application may not be associated with a single I-P datagram that is actually sent.
Port number : Used to indicate the sending and receiving process. Because the I P-layer has already assigned the I P datagram to t C p or U D p (based on the protocol field values in the I P header), the T C P Port number is viewed by T C P, and the U D p port number is viewed by UDP. The T C p port number and UDP port number are independent of each other.
length : The UDP length field refers to the byte length of the UDP header and UDP data. The minimum value for this field is 8 bytes (sending a 0-byte UDP datagram is O K).
Inspection and : UDP inspection and is an end-to-end inspection and. It is computed by the sender and then verified by the receiving end. The purpose is to discover any changes that occur between the UDP header and the data between the sending end and the receiving end.
"Computer network" Ethernet frame, IP,TCP,UDP header structure