IP packet format

Source: Internet
Author: User

IP data packets can be in either IPv4 or IPv6 format. IPv6 is an improved version used to replace the IPv4 protocol in the future. For the purpose of this article, we can ignore the difference between the two for the moment. We only use IPv4 as an example. The following is an IPv4 packet in the IPv4 format. We fold the entire sequence according to 4 bytes to better display the frame. The IP packet header also has multiple regions. We focus on the source address and destination address in red ). They are all IP addresses. The IPv4 address is 4 bytes in length (that is, 32 bits ). We usually divide IPv4 addresses into four decimal numbers, with each number ranging from 0 to 255. For example, 192.0.0.1 is an IP address. The address is written in the binary format in the IP packet header. An IP address is a global address that identifies "Community" (LAN) and "House" (host ). This is achieved by classifying IP addresses. IP class From To Subnet Mask A 1.0.0.0 126.255.255.255 255.0.0.0 B 128.0.0.0 191.255.255.255 255.255.0.0 C 192.0.0.0 223.255.255.255.255 255.255.0 32-bit each IP address is divided into two parts, the first part is used To distinguish the LAN, the second part is used to differentiate the host of the LAN. The Subnet Mask (Subnet Mask) tells us the dividing line between the two parts. For example, 255.0.0.0 (eight digits 1 and 24 digits 0) indicates that the first eight digits are used to distinguish the LAN, the last 24 bits are used to differentiate hosts. As classification A, B, and C have been defined, when an IP address belongs to the scope of Class B, we know that the first 16 bits and the last 16 bits represent the LAN and host respectively.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.