Format of IP datagrams
An IP datagram consists of a header and a data component.
The first part of the header is a fixed-length total of 20 bytes that all IP datagrams must have.
The fixed part of the header is followed by some optional fields whose length is variable.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/85/64/wKioL1eh8-fBLkd0AADLwKoADTo354.png "title=" IP datagram format. png "width=" 720 "height=" 434 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" font-family: ' Microsoft Jas Black ', ' Microsoft Yahei '; white-space:normal;width:720px;height:434px; "alt=" Wkiol1eh8-fblkd0aadlwkoadto354.png "/>
fields in the fixed section of the IP datagram header
Version--4 bits refers to the IP protocol version the current IP protocol version number is 4 (i.e. IPv4)
First Minister--4 digits 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 bits to get a better service is called a 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-The length of the sum of the 16-digit header and the data is in bytes so the maximum length of the datagram is 65535 bytes. The total length must not exceed the maximum transmission unit MTU.
Identity (identification)--16 bits It is a counter used to generate the identity of the datagram.
Flag-3-bit currently 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 indicates the last shard. The one in the middle of the Flag field is DF (Don ' t Fragment). Shards are allowed only if DF = 0 o'clock.
The slice offset (13 bits) 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.
Both the source address and the destination address are 4 bytes.
IP Datagram Sharding
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/85/64/wKiom1eh9hCDdwFBAAD4JkuX-Xw843.png "title=" sharding topic. png "width=" 720 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:720px;height:180px; "alt=" Wkiom1eh9hcddwfbaad4jkux-xw843.png "/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/85/64/wKioL1eh9mqgGUuyAACIWf7J7Xc585.png "style=" width : 693px;height:522px; "title=" Shard. png "alt=" wkiol1eh9mqgguuyaaciwf7j7xc585.png "width=" 693 "height=" 522 "border=" 0 " Hspace= "0" vspace= "0"/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/85/64/wKiom1eh9mvhg3xRAABi_WFmS0g860.png "style=" width : 720px;height:199px; "title=" table. png "width=" 720 "height=" 199 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1eh9mvhg3xraabi_wfms0g860.png "/>
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/85/64/wKioL1eh9sbyQavrAABWjZE812Y453.png "title=" Shard 2.png "width=" 720 "height=" border= "0" hspace= "0" vspace= "0" style= "WIDTH:720PX;HEIGHT:77PX;" alt= " Wkiol1eh9sbyqavraabwjze812y453.png "/>
The process of forwarding packets in IP layer
There are four Class A networks connected by three routers. There can be thousands of hosts on every network.
It can be imagined that the routing table produced by the destination host number is 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.
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/85/67/wKiom1eiqoTQ_tHWAACFkihIr-k638.png "title=" 1.png " alt= "Wkiom1eiqotq_thwaacfkihir-k638.png"/>
Finding the routing table
Depending on the destination network address, you can determine the result of the next hop router doing this
The IP datagram will eventually be able to find the router on the destination network where the destination host is likely to pass multiple indirect deliveries.
Attempts to direct delivery to the destination host are made only when the last router is reached.
Specific host routes
This route specifies a route for a specific destination host.
The use of specific host routing makes it easier for network managers to control the network and test the network and also to take this particular host route when a security issue needs to be considered.
Default route
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 and the network is connected to only one router and the Internet, then using the default route in this case is a good fit.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/85/67/wKiom1eiq1qBAxTgAABsrfEn_Wc988.png "title=" 2.png " alt= "Wkiom1eiq1qbaxtgaabsrfen_wc988.png"/>
Attention
There is no place in the header of the IP datagram that can be used to indicate the IP address of the next-hop router.
When the router receives the datagram to be forwarded instead of filling the IP address of the next-hop router into the IP datagram, it is sent to the lower-level network interface software.
The network interface software uses ARP to convert the IP address of the next-hop router into a hardware address and place the hardware address at the header of the MAC frame of the link layer and then locate the next-hop router based on the hardware address.
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 is indirect delivery execution (3).
(3) If a specific host route with destination D in the routing table is routed to the next hop router indicated in the routing table, the datagram is executed otherwise (4).
(4) If there is a route in the routing table that arrives at network N, the datagram is sent to the next hop router indicated by the routing table otherwise (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 (6).
(6) Error reporting forwarding packet.
Route Selection Protocol
The internet has two major types of routing protocols
The Internal Gateway protocol IGP (Interior Gateway Protocol) is the routing protocol used within an autonomous system. Currently, such routing protocols are used most often, such as RIP and OSPF protocols.
External Gateway Protocol EGP (External Gateway Protocol) If the source and destination stations are in different autonomous systems, a protocol is needed to pass routing information to another autonomous system when the data is transmitted to the boundaries of an autonomous system. Such a protocol is an external gateway protocol EGP. BGP-4 is currently the most used in the external gateway protocol.
The following main introduction to the Internal Gateway Protocol RIP (Routing information Protocol)
Working principle
Routing Information Protocol RIP is the first widely used protocol in the internal Gateway protocol IGP.
RIP is a distributed routing protocol based on distance vectors.
The RIP protocol requires every router in the network to maintain a distance record from itself to every other destination network.
Definition of "distance"
-
The distance from one router to the directly connected network is defined as 1.
-
-
rip protocol is also known as hop count Because the number of hops per router is added by 1.
-
-
-
rip allows a path to contain a maximum of 15 routers.
-
rip cannot use multiple routes between the two networks at the same time. RIP selects a route with the fewest routers, which is the shortest path, even if there is another high-speed (low-latency) router with more routes.
Three points of RIP protocol
Exchange information only with neighboring routers.
The information exchanged is all the information that is currently known to the router as its own routing table.
Exchange routing information at regular intervals, for example, every 30 seconds.
the establishment of the routing table
The router only knows the distance to the directly connected network when it is just starting to work this distance is defined as 1.
Each subsequent router also exchanges and updates routing information only with a very limited number of neighboring routers.
After several updates, all routers will eventually know the shortest distance to any network in this autonomous system and the address of the next-hop router.
The convergence (convergence) process of RIP protocol is the process of getting the correct route selection information in all nodes in autonomous system.
Distance vector algorithm
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/85/67/wKioL1eisKTyCL7xAAF7wIaZ3_c037.png "style=" width : 720px;height:336px; "title=" 3.png "width=" 720 "height=" 336 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1eisktycl7xaaf7wiaz3_c037.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/85/68/wKiom1eisKSRJR5cAAGrg06JCqQ966.png "style=" width : 720px;height:381px; "title=" 4.png "width=" 720 "height=" 381 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1eisksrjr5caagrg06jcqq966.png "/>
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/85/67/wKioL1eisKXTBrYNAAC_sT04ZoU745.png "style=" width : 720px;height:179px; "title=" 5.png "width=" 720 "height=" 179 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1eiskxtbrynaac_st04zou745.png "/>
Example
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/85/67/wKioL1eisZDCzzPXAACpBWFrjsI931.png "style=" width : 720px;height:340px; "title=" 6.png "width=" 720 "height=" 340 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1eiszdczzpxaacpbwfrjsi931.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/85/67/wKioL1eisZGzaTf4AAENJZ4_3Mc650.png "style=" width : 720px;height:365px; "title=" 7.png "width=" 720 "height=" 365 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1eiszgzatf4aaenjz4_3mc650.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/85/68/wKiom1eisZGwmRmlAAAvtdPkJgc355.png "style=" float: none; "title=" 8.png "alt=" Wkiom1eiszgwmrmlaaavtdpkjgc355.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/85/68/wKiom1eisZLw9XerAACHx8AiqWs888.png "style=" width:720px;height:107px; "title=" 9.png "width=" 720 "height=" 107 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1eiszlw9xeraachx8aiqws888.png "/>
650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0041.gif "style=" White-space:normal "alt=" j_0041.gif "/ >650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0041.gif "style=" White-space:normal "alt=" j_0041.gif "/>650" this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0041.gif "style=" White-space:normal "alt=" j_0041. GIF "/>650" this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0041.gif "style=" white-space:normal; "alt=" j_ 0041.gif "/>650" this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0041.gif "style=" white-space:normal; "alt=" J_0041.gif "/>650) this.width=650;" src= "Http://img.baidu.com/hi/jx2/j_0041.gif" alt= "J_0041.gif"/>650) this.width=650, "src=" Http://img.baidu.com/hi/jx2/j_0041.gif "style=" White-space:normal; alt= "J_0041.gif"/> 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0041.gif "style=" White-space:normal "alt=" j_0041.gif "/ >650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0041.gif "alt=" J_0041.gif "/>650) this.width=650, "src=" Http://img.baidu.com/hi/jx2/j_0041.gif "style=" White-space:normal; alt= "J_0041.gif"/> 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0041.gif "style=" White-space:normal "alt=" j_0041.gif "/ >650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0041.gif "style=" White-space:normal "alt=" j_0041.gif "/>
This article is from the "11408774" blog, please be sure to keep this source http://11418774.blog.51cto.com/11408774/1834234
--ip datagram, shard strategy, routing Table of Network Foundation