In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Format of IP Datagram
An IP Datagram consists of a header and data.
The first part of the header is a fixed length of 20 bytes that all IP datagrams must have.
Behind the fixed part of the header are some optional fields whose length is variable.
Fields in the fixed part of the header of an IP Datagram
Version-4 places refer to the version of the IP protocol the current IP protocol version number is 4 (that is, IPv4)
Header length-the maximum value that can be represented by 4 bits is 15 units (one unit is 4 bytes), so the maximum header length of IP is 60 bytes.
Differentiated services-eight places are used to get better services called service types in the old standards but have never been used in practice. This field was renamed DiffServ in 1998. This field works only when using DiffServ DiffServ. This field is not used under normal circumstances
Total length-16 bits means that the total length of the 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 transfer unit MTU.
Identification-16 bits it is the identity used by a counter to generate datagrams.
Logo (flag)-occupies 3 places, only the first two are meaningful at present. The lowest bit of the flag field is MF (More Fragment). MF = 1 means "there are still fragments" after it. MF = 0 indicates the last shard. The bit in the middle of the flag field is DF (Don't Fragment). Sharding is allowed only when DF = 0.
The slice offset (13 bits) indicates the relative position of a piece in the original packet after the slicing. The slice offset is in 8 bytes.
Time to live (8 bits) is recorded as the maximum number of routers that a TTL (Time To Live) Datagram can pass through in the network.
The protocol (8-bit) field indicates which protocol is used for the data carried by this Datagram so that the IP layer of the destination host can hand over part of the data to which process
The header check and (16-bit) fields only verify that the header of the Datagram does not check the data portion. Instead of using CRC check code, a simple calculation method is adopted here.
Source address and destination address each occupy 4 bytes
IP Datagram fragmentation
The process of forwarding packets at the IP layer
There are four Class A networks connected by three routers. There may be thousands of hosts on each network.
It is conceivable that if the routing table is made according to the destination host number, the routing table will be too large.
However, if the routing table is made according to the network address of the host, then the routing table in each router will contain only four items. This greatly simplifies the routing table.
Look up the routing table
The next-hop router can be determined according to the destination network address, and the result is
The IP Datagram will eventually be able to find the router on the destination network where the destination host may have to be delivered indirectly multiple times.
Direct delivery to the destination host is attempted only when the last router is reached.
Specific host routin
This route indicates a route for a specific destination host.
The use of specific host routing makes it easier for network managers to control and test the network, and can also use this specific host route when a security issue needs to be considered.
Default route (default route)
Routers can also use default routes to reduce the space taken up by the routing table and the time it takes to search the routing table.
This forwarding method is useful when a network has only a few external connections.
The default route often shows its benefits when the host sends IP datagrams.
If a host is connected to a small network and the network uses only one router to connect to the Internet, it is appropriate to use a default route in this case.
Be careful
There is no place in the header of the IP Datagram to indicate the "IP address of the next-hop router".
When the router receives the Datagram to be forwarded, it does not fill in the IP address of the next-hop router into the IP Datagram but sends it to the lower layer of network interface software.
The network interface software uses ARP to translate the IP address of the next-hop router into a hardware address and place this hardware address at the beginning of the MAC frame at the link layer and then find the next-hop router based on this hardware address.
Packet forwarding algorithm
(1) extract the IP address D of the destination host from the header of the Datagram and get that the destination network address is N.
(2) if the network N is directly connected to the router, the Datagram is delivered directly to the destination host D, otherwise it is indirectly delivered (3).
(3) if there is a specific host route with a destination address D in the routing table, the Datagram is transmitted to the next-hop router specified in the routing table.
(4) if there is a route to network N in the routing table, the Datagram is transmitted to the next-hop router specified in the routing table.
(5) if there is a default route in the routing table, the Datagram is transmitted to the default router specified in the routing table.
(6) report an error in forwarding packets.
Routing protocol
There are two main types of routing protocols on the Internet.
Interior Gateway Protocol IGP (Interior Gateway Protocol) is a routing protocol used within an autonomous system. At present, such routing protocols are most commonly used, such as RIP and OSPF protocols.
External Gateway Protocol EGP (External Gateway Protocol) if the source and destination stations are in different autonomous systems, when data packets are transmitted to the boundaries of one autonomous system, it is necessary to use a protocol to transmit routing information to another autonomous system. Such a protocol is the external gateway protocol EGP. At present, BGP-4 is the most widely used external gateway protocol.
The following mainly introduces the interior gateway protocol RIP (Routing Information Protocol)
working principle
Routing Information Protocol (RIP) is the first widely used protocol among the interior gateway protocols (IGP).
RIP is a distributed routing protocol based on distance vector.
The RIP protocol requires every router in the network to maintain a record of the distance from itself to every other destination network.
The definition of "distance"
The distance from a router to a directly connected network is defined as 1.
The distance from a router to a network that is not directly connected is defined as the number of routers passed by plus 1.
The "distance" in the RIP protocol is also known as the "hop count" (hop count) because it adds 1 to each hop passing through the router.
The "distance" here actually refers to the "shortest distance".
RIP believes that a good route is that it passes through a small number of routers, that is, "short distance".
RIP allows a path to contain up to 15 routers.
A maximum distance of 16:00 is equivalent to being unreachable. It can be seen that RIP is only suitable for small-scale Internet.
RIP cannot use multiple routes between two networks at the same time. RIP chooses a route with the least number of routers, that is, the shortest route, even if there is another high-speed (low-delay) route with more routers.
Three key points of RIP Protocol
Exchange information only with neighboring routers.
The information exchanged is all the information currently known to this router, that is, its own routing table.
Exchange routing information at regular intervals, for example, every 30 seconds.
Establishment of routing table
When the router first starts working, it only knows the distance to the directly connected network. This distance is defined as 1.
In the future, each router will only exchange and update routing information 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 faster, that is, the process that all nodes in the autonomous system get the correct routing information.
Distance vector algorithm
Example
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.