IPV4 and IPV6 names
IPV4 and IPV6 only do two things:
It does not need to define the rules for data transmission. How data is transmitted is defined by two layers.
① Define the format of the Layer 3 header. What functions does the three layers have.
② Define layer 3 address information. IPV4 defines an IPV4 address, and IPV6 defines an IPV6 address.
Definition of Agreement
Whether it is IPV4, IPV6, Layer 2 protocol, Layer 3 protocol, or Layer 4 protocol, they are all called encapsulation protocols. These protocols themselves do not generate data. These protocols only define an encapsulation packet. These protocols provide three-layer encapsulation services when forwarding traffic for upper-layer applications.
A data frame received in the Ethernet environment is encapsulated by Ethernet II. The value of its type field is 0X0800, which means that the third layer uses IPV4. The value of the Type field is 0x86DD, which means that Layer 3 uses IPV6.
IPV4 header: from left to right, from top to bottom.
One of them is IP Options, which means that your IP header can contain this field or not, indicating that the IPV4 header is variable length. These variable lengths are also divided into two parts:
The first is the main header. There are 12 fields in the first five rows as shown.
The second is the extension header. The last line has 1 field as shown.
Summary of IPv4 header length:
The shortest is 20 bytes, each layer is 4 bytes long, and there are 5 layers in total. The options are that the extension header is up to 40 bytes long, and the IPV4 header length is 20-60 bytes.
All three-layer encapsulation protocols and four-layer encapsulation protocols follow a principle when designing the packet architecture:
The length of three layers and four layers must be divisible by 4 bytes. Ethernet 2 is that 14 bytes cannot be divisible by 4 bytes because it does not belong to the category of Layer 3 and Layer 4.
There are many advanced extension features in the IPV4 environment. If you want to apply these features, you must extend some fields to the main header. All the optional fields that are extended are optional. The options have many fields and their meanings are different. When expanding, it is possible to expand some of them, and it is possible to expand all of them. When expanding some fields, it will appear when you add the extended header to the main header. Its length cannot be changed by 4. Divisible by bytes, the solution is to pad consecutive 0s after the optional header until it is divisible by 4 bytes.
Interpretation of the main header:
The first field Version (version) description is IPV4.
The second field Header Lengh (header length) describes how many bytes you have. Because the length is variable, how many bytes of data you send each time cannot be determined. This field is used to tell the receiver whether your IP header has been added or not. Option, no addition is 20 bytes, addition is greater than 20 bytes.
The third field Type Of Service is referred to as TOS. Used to achieve IP QoS (Quality of Service). In the current network environment, there are surfing traffic for online games, office business traffic, bulk data traffic for uploading and downloading bulk files, interactive video conference traffic, VoIP voice traffic, and dynamic routing protocol traffic. It is required to handle these traffics in a differentiated way, and it is necessary for network devices to make a distinction based on the characteristics of the traffic, which is called traffic classification.
After traffic classification, in order to prevent subsequent routers from distinguishing traffic through complicated manual operations, different types of traffic are marked with different types of marks. When IPv4 is used at Layer 3, this mark is placed in the TOS field, 1 byte.
The fourth field Total Length (total length) refers to the number of bytes in the complete data packet including the IP header, which does not include the frame header and the end of the frame.
The fifth, sixth, and seventh fields are identifiers, tags, and segment offsets, which are mainly used for three-layer data sharding. Usually the transport layer is used for data slicing, but the third layer also has the capability of data slicing and generally uses IPV4.
Identifier: used to identify all fragments belonging to the same packet with a tag value and different packet fragments belong to different tag values to distinguish from each other.
Mark: It’s only 3bit
Fragment offset: The fragment offset of each fragment describes the bit to bit of this fragment relative to this complete packet. According to the byte interval to which the fragment of each data packet belongs, the receiver will be out of order after receiving a number of fragments. I can do a reordering according to your sequence to ensure that the fragmented data packet can be sent to package. (Four-layer slicing is the essential attribute of the four-layer protocol. This slice does not consume much CPU and memory. However, three-layer slicing leads to a decrease in network quality, so it is not recommended to use three-layer slicing).
The eighth field Time to Live is referred to as TTL. Describes how long a packet can travel when it is sent over the network. It is represented by the number of hops. A hop is a layer 3 network device. The hop count is to limit how many hops a data packet can transmit in the network, prevent routing loops, avoid the endless transmission of data packets in the path, consume link bandwidth and consume CPU resources, and design a TTL for data packets to transmit at most 255 If it reaches 255 hops, it will be discarded, because the hardware of each router will contain a packet rewriting engine that specifically modifies the fields of the three-layer header. After receiving the data packet through the receiving interface, the TTL value is -1 and reduced to 0. Packets are lost.
The ninth field Protocol (upper layer protocol) is used to describe what protocol the data packet transport layer uses.
The tenth field Header Checksum performs a check on the header field of the IP header through the hash algorithm CRC, and puts the hash algorithm value into this field. After the receiver receives the data packet, it will perform a check on the entire Layer 3 header and get a garbled code. Compare the new garbled code obtained by the header check check to see if it is consistent. The consistency means that the Layer 3 header of the data packet has not been Tampered.
The eleventh field, Source IP Address, describes the sending interface where the data traffic is sent.
The twelfth field, Destination IP Address, describes the interface on which the data traffic is received. Layer 3 addresses have end-to-end consistency, excluding public addresses and private addresses, and excluding PAT. The so-called end-to-end Layer 3 consistency means that the source sends traffic to the destination, regardless of the network environment in which the data packet is sent to its source. The destination address remains unchanged.
IPV6 header format:
Yellow represents fields that are common to IPV4 and IPV6 and have the same name. The source and destination IP addresses of IPV6 are 128 bits, the source address is 16 bytes, and the destination address is 16 bytes.
Red represents fields in IPV4 tables that are not in IPV6. The header in IPV6 is a fixed-length 40Bit. IPV6 does not have identifiers, markers and split offsets, which means that IPV6 does not recommend three-layer data slicing. There are two advantages: one is to reduce the CPU consumption in the path and increase the end-to-end efficiency.
Blue means that both IPV4 and IPV6 have similar functions but have changed their names. Traffic Class in IPV6 is used for QOS marking.
Payload length refers to the number of bytes in our four-layer data segment after removing the IPV6 header.
Hop Limit refers to TTL.
Next Header (next header) in IPV6 may refer to the transport layer, which may be the next layer of your main header.
Gray represents the newly defined IPV6 called flow label. The flow label is combined with SDIP, combined with the traffic class locking from time to time, when you lock a flow, do flow-based policies.
Comparison of IPV6 and IPV4: Although the main header of IPV6 is longer than that of IPV4, the SDIP part is longer. The router receives these two layers of three-encapsulated data, and the processing of the IPV6 header is relatively simple.
ThinkMo CCNA Dump exam information exchange group：
CCNA/CCNP/CCIE telegram study group：https://t.me/ccie_ei_lab
ThinkMo CCNA 200-301 Tutorial VIP Exclusive：
The complete EVE_NG file, free learning PDF and PPT that can be used directly, as well as video explaining the technical points are all here!