IP protocol, ARP protocol, RARP Protocol

Source: Internet
Author: User

IP Datagram

IP is the core protocol in the TCP/IP protocol family. All TCP, UDP, ICMP, and IGMP data are transmitted in the IP datagram format. The IP address only provides the best-effort transmission service. If an error occurs, the IP address will lose the data and send an ICMP message to the source. In addition, IP datagram can not be accepted in the sending order.

The IP datagram format is as follows:

 

The first 20 bytes and the subsequent options are the IP datagram header. The first 20 bytes are fixed and optional. Each row in the header is a 32-bit unit, with the highest bit on the left, 0 bit, and 31 bit on the right. The 32bit values of 4 bytes are transmitted in the following order: first 0-7 bit, second 8-15 bit, then 16-23 bit, and finally 24-31 bit, this transmission order is called the big endian byte order (this word is often used in the algorithm of bit write operations in C language ). All the binary integers in the TCP/IP Header must be in this order when they are transmitted over the network. Therefore, it is also called the network byte order. binary data stored in other forms, such as the little endian format, the header must be converted into the network byte order before data transmission.

The Header Length refers to the number of 32-bit characters in the header. Because the maximum value of 4 characters is 15, the header length is up to 60 bytes, that is, the maximum value of the Option part is 40 bytes, fill in 0 to make the starting address of the Data part a multiple of 4.

The total length refers to the length of the entire IP datagram, including the header and data part, 16 bits, up to 65535 bytes. Although theoretically a 65535 IP datagram can be transmitted, the maximum network carrying capacity and other factors must be considered. The size of the standard TCP/IP group is 576 bytes, subtract 20 bytes from the IP header, 20 bytes from the TCP header, and 24 bytes from the Routing header, Which is 512 bytes, therefore, the data portion of the datagram received by the host generally does not exceed 512 bytes. (PS: I don't know much about this. Many people on the Internet also have this question. Xie xiiren's computer network writes an IP datagram at least 576 bytes, nima translates the data into no more than 576 bytes. Let's take a look at it later, and we may see it later ).

The three flag bits are mainly used to identify the IP datagram of the shard. the first byte of the fragmented datagram deviates from the location of the entire original datagram.

IP Route Selection

The host is connected to the target host through a vro. When a host uses an IP datagram to connect to the target host, follow these steps to search for the target host (the search in the same network must go through the ARP Protocol to resolve the IP address of the target host to the MAC address ):

1. Search the route table and search for matched hosts first. If the target host is exactly the same as the IP address, send the package to the target host.

2. Search the route table. If the match fails, the router in the same subnet is matched. This requires the assistance of the subnet mask. If a vro is found, the package is sent to the vro.

3. Search for the route table. If a vro with the same subnet fails to match, the vro with the same network number is matched. If a vro is found, the packet is sent to the vro.

4. Search for the route table. If all the preceding steps fail, search for the default route. If the default route exists, send the packet

5. If both fail, discard the package.

Subnet Mask

The host number is then divided into a sub-network number and a host number, and a network is divided into several subnets. The subnet mask is connected to the IP address in the subnet, And the subnet is obtained, the subnet is not transparent to the vrouters In the subnet. That is to say, when an IP datagram is transmitted to the gateway of the network, the gateway then transmits the datagram to the default vro of the subnet, finally, the router is used to pay the host.

ARP and RARP

As mentioned above, ARP is only used in the LAN to resolve IP addresses to MAC addresses. Each host in the LAN has an ARP cache, which stores the ing records of the recently initiated IP address to the MAC address. When the host wants to send data to a host in the LAN, it first looks for the target IP address from its own cache to see if it exists. if it finds it, it finds its MAC address through ing and sends it to the past. If it does not find the target IP address, it sends a broadcast to the LAN. The broadcast contains its own IP address, MAC address, and IP address of the target host. All hosts in the LAN will receive the broadcast, however, only the host with the destination IP address will respond and send its MAC address to the source host. After receiving the IP address, the source host will add the ing to its ARP cache, send data to the target host based on the sent MAC address.

In ARP high-speed cache, a timeout value is usually set for table items. If the table item does not communicate with a host for a period of time, the ing between the IP address of the host and the MAC address is removed, broadcast is still sent when communication is required.

If an ARP request is sent from one network host to another, the router connecting the two networks can answer the request. This process becomes an ARP proxy.

RARP is the opposite. It resolves the MAC address into the corresponding IP address and is rarely used independently.

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.