"TCP/IP Detailed Volume 1: Protocol" 3rd IP: Internet Protocol (1)-Reading notes

Source: Internet
Author: User

Chapter Review:

"TCP/IP Detailed Volume 1: Agreement" 1th Chapter Overview-Reading Notes

"TCP/IP Detailed Volume 1: Protocol" chapter 2nd link layer-Reading notes

1. Introduction

IP is the most central protocol in the family of TCP/IP protocols. All TCP, UDP, ICMP, and IGMP data are transmitted in an IP datagram format. IP provides unreliable, non-connected datagram delivery services.

(1) unreliable

It does not guarantee that IP datagrams will successfully reach their destination. IP only provides the best transport service. In the event of an error, such as a router temporarily running out of buffers, IP has a simple error-handling algorithm: Discards the datagram and sends an ICMP message to the source end. The reliability of any requirement must be provided by the upper layer (for example, TCP).

(2) No connection

IP does not maintain any status information about subsequent datagrams. The processing of each datagram is independent of each other. That is, IP datagrams can not be received in the order they were sent. If a source sends two consecutive datagrams (first A, then B) to the same beacon, each datagram is routed independently and may choose a different route, so B may arrive before a arrives.

2. IP header

The IP datagram is shown in format 3-1.

IP Datagram Description:

(1) The general IP First Minister is 20 bytes unless the option field is included. The highest bit is on the left, which is recorded as 0 bit;

(2)the 4 byte value is transmitted in the following order: first 0~7 bit, second 8~15 bit, then 1 6~23 bit, and finally 24~31 bit. This transmission order is called the big endian byte order . Since all binary integers in the TCP/IP header are transmitted in the network, this order is called the network byte order . Machines that store binary integers in other forms, such as the little endian format, must convert the header into a network byte order before transmitting the data.

(3) the current protocol version number is 4, so IP is sometimes referred to as IPv4.

(4) the service type (TOS) field includes a 3 bit priority subfield (now ignored), 4 bit TOS subfield and 1 bit unused bit, but must be set to 0. The 4 bit TOS represents: minimum delay, maximum throughput, maximum reliability, and minimum cost . Only 1 bits can be placed in 4 bit. If all 4 bits are 0, then it means General Service. Figure 3-2 Lists the recommended TOS values for different applications.

Note: The TOS feature is not supported by most TCP/IP implementations today.

(5) The total Length field refers to the length of the entire IP datagram, in bytes. Because the word is 16 bits long, the IP datagram can be up to 65535 bytes in length.

Note: Although you can transfer an IP datagram that is up to 65535 bytes long, most of the link layers will fragment it. Also, the host requires that it cannot receive more than 576 bytes of datagrams.

(6) the Identity field uniquely identifies each datagram sent by the host. It usually adds 1 to the value of each message sent.

(7) The TTL 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 the TTL is set by the source host (typically 32 or 64), 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 ICMP packet is sent to notify the source host.

(8) the Protocol field, which can identify which protocol transmits data to the IP.

(9) the first Test and the field is based on the IP header calculation of the test and code.

option, which is a variable-length optional information in the datagram. These options are rarely used, and not all hosts and routers support these options.

3.IP route selection

IP routing is simple, especially for hosts. If the destination host is directly connected to the source host (such as a point-to-point link) or both on a shared network (Ethernet or Token Ring network), then the IP datagram is sent directly to the destination host. Otherwise, the host sends the datagram to a default router, which is forwarded by the router to the datagram.

Description: Most multi-user systems can be configured as a single router. We can specify a simple routing algorithm that both the host and the router can use. essentially the difference is that the host never forwards the datagram from one interface to another, while the router forwards the datagram.

(1) IP Datagram Processing process

IP can receive datagrams from TCP, UDP, ICMP, and IGMP (that is, locally generated datagrams) and send them, or receive datagrams (datagrams to be forwarded) from a network interface and send them. the IP layer has a routing table in memory. When a datagram is received and sent, it is searched once for the table. When the datagram comes from a network interface, IP first checks whether the destination IP address is one of the native IP addresses or the IP broadcast address.

If this is the address: The datagram is sent to the Protocol module specified by the IP Header Protocol field for processing. If this is not the address: If the IP layer is set as the function of the router, the datagram is forwarded; otherwise the datagram is discarded.

(2) information contained in the routing table

Each item in the routing table contains the following information:

1) Destination IP address.

It can be either a full host address or a network address , specified by the Flag field in the table. The host address has a host number other than 0 to specify a specific host, and the host number in the network address is 0 to specify all hosts in the network (such as Ethernet, Token Ring).

2) The IP address of the next-hop router, or a network IP address with a direct connection.

The next-hop router refers to a router on a directly connected network that can forward datagrams. The next-hop router is not the ultimate goal, but it can forward the datagram that is sent to it for the ultimate purpose.

3) logo.

One of the flags indicates whether the destination IP address is a network address or a host address, and the other flag indicates if the next-hop router is a true next-hop router or a directly connected interface.

4) Specify a network interface for the transmission of datagrams.

(3) IP routing features that are primarily accomplished

IP routing is performed on a per-hop basis. IP does not know the full path to any destination (except, of course, those that are directly connected to the host). All IP routing options provide only the IP address of the next-hop router for datagram transmissions. It assumes that the next-hop router is closer to the destination than the host sending the datagram, and that the next-hop router is directly connected to the host.

1) Search the routing table for a table that matches the destination IP address exactly (network number and host number must match). If found, sends the message to the next station router or directly connected network interface specified by the table (depending on the value of the Flag field).

2) Search the routing table to find the table that matches the destination network number. If found, the message is sent to the next station router or directly connected network interface specified in the table.

3) Search the routing table for the table labeled "Default". If found, the message is sent to the next station router specified in the table.


(1) If none of the above steps are successful, then the datagram cannot be transmitted. If datagrams that cannot be delivered come from the native, then it is common to return a "host unreachable" or "Network unreachable" error to the application that generated the datagram.

(2) The full host address match is performed before the network number matches. Select the default route only if they fail .

(3) assigning a router to a network without having to specify a router for each host is a fundamental feature of the IP routing mechanism . Doing so can greatly reduce the size of the routing table, for example, routers on the internet have only thousands of of the tables, and not more than 1 million of the table entries.

PS: This chapter does not complete the task today, the remainder of this chapter will be summarized tomorrow.

"TCP/IP Detailed Volume 1: Protocol" 3rd IP: Internet Protocol (1)-Reading notes

Related Article

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.