IP datagram format and Routing and forwarding algorithm

Source: Internet
Author: User

IP datagram Header and data are composed of two parts:

The first part is the fixed part and the variable part

Version-4-bit, the IP protocol version of the current IP protocol version number is 4 (that is, IPV4)

First Minister--4 bits, the maximum value that can be represented is 15 units (one unit is 4 bytes) so the maximum of the first ministerial degree of the IP is 60 bytes.

Differentiated Services--8-bit, for better service is called the service type in the old standard, but has not been used in practice. 1998 This field is renamed as Differentiated Service. This field only works if you are using Differentiated Services (DIFFSERV). This field is not used in the general case

Total length-16 bits, the length of the header and the sum of the data, in bytes, so the maximum length of the datagram is 65535 bytes. The total length must not exceed the maximum transmission unit MTU.

The identifier (identification) occupies 16 bits, which is a counter used to generate the identity of the datagram.

Flag is 3-bit, and only the first two digits are meaningful. The lowest bit of the Flag field is MF (more Fragment). Mf? 1 means "There are shards" behind. Mf? 0 represents the last shard. The one in the middle of the Flag field is DF (Don ' t Fragment). Only when DF? Shards are not allowed until 0 o'clock.

The slice offset (13-bit) indicates the relative position of a piece in the original grouping after the Shard. The slice offset is offset in 8 bytes.

The time-to-live (8-bit) is the maximum number of routers that can be passed in the network by the TTL (Times to Live) datagram.

The Protocol (8-bit) field indicates what protocol is used for the data carried by this datagram so that the IP layer of the destination host gives the data part to which process

The first Test and the (16-bit) field only test the data portion of the header of the datagram. The CRC test code is not used here and the simple calculation method is adopted.

The variable part of the IP header is an option field that is useful for troubleshooting, measuring, and security measures. Option fields are variable in length, ranging from 1 bytes to 40 bytes, depending on the item selected. The variable portion of the header is added to increase the functionality of the IP datagram, but it also makes the header length of the IP datagram variable. This increases the overhead of each router handling datagrams. In fact, these options are rarely used.

Packet forwarding:

There are four Class A networks connected by three routers. There can be thousands of hosts on every network. As you can imagine, if you make the routing table by the destination host number, the resulting routing table will be too large. However, if the routing table is made by the network address of the host, then the routing table in each router contains only 4 items. This allows the routing table to be greatly simplified.

The next hop router can be determined based on the destination network address, and the result is that the IP datagram will eventually be able to find the router on the destination network where the destination host is located (possibly through multiple indirect deliveries). Direct delivery to the destination host is attempted only when the last router is reached.

This route specifies a route for a specific destination host. The use of specific host routing makes it easier for network managers to control network and test networks, as well as to take this particular host route when a security issue needs to be considered.

Routers can also take a default route to reduce the space used by the routing table and the time it takes to search the routing table. This kind of forwarding is useful when a network has very few external connections. The default route is often more likely to show its benefits when the host sends an IP datagram. If a host is connected to a small network with only one router and Internet connection, then it is appropriate to use the default route in this case

Packet forwarding algorithm

(1) Extract the destination host's IP address D from the header of the datagram, and obtain the destination network address N.

(2) If network N is directly connected to this router, the datagram is delivered directly to the destination host D; otherwise it is indirect delivery, execution (3).

(3) If the routing table has a specific host route with destination D, the datagram is routed to the next-hop router indicated in the routing table; otherwise, it is executed (4).

(4) If the routing table has a route to reach network N, the datagram is transmitted to the next hop router indicated in the routing table; otherwise, it is executed (5).

(5) If there is a default route in the routing table, the datagram is routed to the default router indicated in the routing table; otherwise, it is executed (6).

(6) Error reporting forwarding packet.

IP datagram format and Routing and forwarding algorithm

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.