CN108965122B - Routing method, device and computer readable storage medium - Google Patents

Routing method, device and computer readable storage medium Download PDF

Info

Publication number
CN108965122B
CN108965122B CN201710361783.XA CN201710361783A CN108965122B CN 108965122 B CN108965122 B CN 108965122B CN 201710361783 A CN201710361783 A CN 201710361783A CN 108965122 B CN108965122 B CN 108965122B
Authority
CN
China
Prior art keywords
routing
message
route
router
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710361783.XA
Other languages
Chinese (zh)
Other versions
CN108965122A (en
Inventor
韦先霜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CN201710361783.XA priority Critical patent/CN108965122B/en
Publication of CN108965122A publication Critical patent/CN108965122A/en
Application granted granted Critical
Publication of CN108965122B publication Critical patent/CN108965122B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/24Multipath
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/70Routing based on monitoring results
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a route selecting method, a device and a computer readable storage medium, wherein the route selecting method comprises the following steps: receiving a message, and extracting a target IP and a message length corresponding to the message; according to the destination IP, searching the routing information corresponding to the destination IP in a preset routing table; detecting whether a target route with a PMTU value larger than or equal to the message length exists according to the routing information; and if the target route with the PMTU value larger than or equal to the message length exists, determining the route of the optimal path in the target route according to a preset routing algorithm. The invention can avoid the condition that the message length is larger than the MTU value of the routing equipment and is discarded or the routing equipment fragments the message to influence the transmission rate in the transmission process of the message to a certain extent, thereby improving the data transmission efficiency.

Description

Routing method, device and computer readable storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a routing method, a device, and a computer-readable storage medium.
Background
In a complex network environment and business logic, several routing devices may need to be deployed for transmitting data, and default MTU (Maximum Transport Unit) values of the routing devices may be different. When the MTU value of the device on the transmission path determined by the routing algorithm is smaller than the message length, user traffic may be abnormal. For example, part of the routing devices on the transmission path do not support IPv4 fragmentation, and when a received packet is larger than its MTU, even if the DF (Don't Fragment) identifier in the header of the packet is not set, the DF (Don't Fragment) identifier is directly discarded, thereby causing user service exception; when the routing equipment on the transmission path supports IPv4 fragmentation, and when the received message is greater than its MTU, the routing equipment performs IPv4 fragmentation on the message, which may affect the transmission rate in a scenario of a large amount of data streams.
Disclosure of Invention
The invention mainly aims to provide a routing method, aiming at solving the technical problem that the abnormal user service can be caused when the MTU value of equipment on a transmission path determined according to a routing algorithm is smaller than the message length in the prior art.
In order to achieve the above object, the present invention provides a route selecting method, including:
receiving a message, and extracting a target IP and a message length corresponding to the message;
according to the destination IP, searching the routing information corresponding to the destination IP in a preset routing table;
detecting whether a target route with a PMTU value larger than or equal to the message length exists according to the routing information;
and if the target route with the PMTU value larger than or equal to the message length exists, determining the route of the optimal path in the target route according to a preset routing algorithm.
Optionally, the receiving the packet, before extracting the destination IP and the packet length corresponding to the packet, includes:
generating a routing information message according to a local routing table;
and filling the local router MTU value information into the routing information message, and sending the routing information message to the adjacent router of the local router.
Optionally, before receiving the packet and extracting the destination IP and the packet length corresponding to the packet, the method further includes:
receiving a routing information message sent by an adjacent router, and detecting whether the routing information message contains MTU value information of the adjacent router;
if the routing information message contains the MTU value information of the adjacent router, the routing information message is stored to a local routing table, and the local routing table information is calculated and updated according to the routing information message.
Optionally, the receiving a routing information packet sent by an adjacent router, and detecting whether the routing information packet includes MTU value information of the adjacent router, includes:
if the routing information message does not contain the MTU value information of the adjacent router, the routing information message is stored in a local routing table, the information of the local routing table is calculated and updated according to the routing information message, and the MTU value of the adjacent router in the local routing table is set to be zero.
Optionally, the detecting whether a target route with a PMTU value greater than or equal to the packet length exists according to the routing information includes:
if no target route with the PMTU value larger than or equal to the message length exists, determining the route of the optimal path in all routes corresponding to the route information according to a preset routing algorithm;
and forwarding the message according to the route of the optimal path.
Optionally, the detecting whether a target route with a PMTU value greater than or equal to the packet length exists according to the routing information includes:
detecting whether at least two routes with different PMTU values exist according to the routing information;
and if at least two routes with different PMTU values exist, detecting whether a target route with a PMTU value larger than or equal to the message length exists in the at least two routes with different PMTU values.
Optionally, the detecting whether there are at least two routes with different PMTU values according to the routing information includes:
if at least two routes with different PMTU values do not exist, determining the route of the optimal path in all routes corresponding to the route information according to a preset routing algorithm;
determining an output interface and a next hop corresponding to the route of the optimal path according to the route of the optimal path;
and forwarding the message according to the outgoing interface and the next hop.
In addition, to achieve the above object, the present invention further provides a route selecting device, including: a memory, a processor and a routing program stored on the memory and executable on the processor, the routing program when executed by the processor implementing the steps of the routing method as described above.
Furthermore, to achieve the above object, the present invention also provides a computer readable storage medium having stored thereon a route routing program, which when executed by a processor, implements the steps of the route routing method as described above.
In the invention, when a message is received, a destination IP and a message length corresponding to the message are extracted, a route with a PMTU (Path MTU) value which is larger than or equal to the message length and corresponds to the destination IP is searched in a routing table according to the destination IP and the message length, a route of an optimal path is determined according to a routing algorithm, and the message is forwarded according to the route of the optimal path. In the invention, the PMTU value is used as a factor to be added into a routing algorithm, and the route with the PMTU value larger than or equal to the message length is preferentially selected, so that the condition that the message transmission rate is influenced (the routing equipment supports IPv4 fragmentation) because the message length is larger than the MTU value of the routing equipment and is discarded (the routing equipment does not support IPv4 fragmentation) or the routing equipment fragments the message in the transmission process of the message is avoided.
Drawings
FIG. 1 is a schematic diagram of an apparatus architecture of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a first embodiment of the routing method of the present invention;
FIG. 3 is a schematic diagram illustrating an embodiment of a transmission path from the router to the receiving end A;
FIG. 4 is a flowchart illustrating a second embodiment of the routing method of the present invention;
fig. 5 is a detailed flowchart of step S30 in fig. 2.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As shown in fig. 1, fig. 1 is a schematic device structure diagram of a hardware operating environment according to an embodiment of the present invention.
The device of the embodiment of the present invention may be a gateway device, for example, a router.
As shown in fig. 1, the apparatus may include: a processor 1001, such as a CPU, network interface(s) 1004, user interface 1003, memory 1005, communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration of the apparatus shown in fig. 1 is not intended to be limiting of the apparatus and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is one type of computer storage medium, may include an operating system, a network communication module, a user interface module, and a routing program.
In the device shown in fig. 1, the network interface 1004 is mainly used for connecting to a backend server and performing data communication with the backend server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be configured to invoke the routing program stored in the memory 1005 and perform the following operations:
receiving a message, and extracting a target IP and a message length corresponding to the message;
in this embodiment, the message refers to a data unit exchanged and transmitted in the network, and includes complete data information to be sent. When the router receives the message, the destination IP corresponding to the message is extracted, for example, the destination IP of the message is a receiving end a, and the length of the message is L.
According to the destination IP, searching the routing information corresponding to the destination IP in a preset routing table;
according to the destination IP corresponding to the packet, for example, if the destination IP of the packet is the receiving end a, the routing information from the router to the receiving end a (i.e., the transmission path from the router to the receiving end a) is searched in the preset routing table. As shown in fig. 3, fig. 3 is a schematic view of an embodiment of a transmission path from the router to the receiving end a. In one embodiment, there are 3 pieces of routing information from the router to the receiving end a.
Detecting whether a target route with a PMTU value larger than or equal to the message length exists according to the routing information;
in this embodiment, if there are 3 pieces of routing information from the router to the receiving end a, the PMTU values corresponding to the five pieces of routing information are: path a, 1000 bytes; path b, 1200 bytes; path c, 1300 bytes; path d, 1400 bytes; path e, 1500 bytes. If the message length L is 1300 bytes, the PMTU values of three paths of the path c, the path d and the path e are more than or equal to the message length L.
If a target route with the PMTU value larger than or equal to the message length exists, determining the route of the optimal path in the target route according to a preset routing algorithm;
in this embodiment, when it is detected that a route with a PMTU value greater than or equal to the message length L exists, for example, the message length L is 1300 bytes, and PMTU values of three paths, namely, path c (the PMTU value is 1300 bytes), path d (the PMTU value is 1400 bytes) and path e (the PMTU value is 1500 bytes), are greater than or equal to the message length L, the route of the optimal path is determined among the three paths, namely, path c, path d and path e, according to a preset routing algorithm. In this embodiment, the routing algorithm is a routing algorithm, and the purpose of the algorithm is to find a route from a source router to a destination router (i.e., from the router to a receiving end a corresponding to a message destination IP) on an optimal path. Parameters considered for "optimal routing" include such things as the number of hops (the travel of a packet from one router or intermediate node to another in the network), latency, and the time it takes for the packet to transmit traffic. In this embodiment, the preset routing algorithm may be an LS algorithm, a Dijkstra algorithm, a link vector routing algorithm, and the like, which is not limited herein and is specifically selected according to actual needs.
In this embodiment, when the PMTU value is greater than or equal to the message length L in a plurality of paths, a route of an optimal path is determined according to a preset routing algorithm. For example, the route of the optimal path determined according to the preset routing algorithm is a path e, an interface and a next hop are determined according to the information of the path e and the position of the route in the path e, and the message is forwarded according to the outgoing interface and the next hop.
In the invention, when a message is received, a destination IP and a message length corresponding to the message are extracted, a route with a PMTU (Path MTU) value larger than or equal to the message length corresponding to the destination IP is searched in a routing table according to the destination IP and the message length, in the route with the PMTU value larger than or equal to the message length, the route of an optimal path is determined according to a routing algorithm, and the message is forwarded according to the route of the optimal path. In the invention, the PMTU value is used as a factor to be added into a routing algorithm, and the route with the PMTU value larger than or equal to the message length is preferentially selected, so that the condition that the message transmission rate is influenced (the routing equipment supports IPv4 fragmentation) because the message length is larger than the MTU value of the routing equipment and is discarded (the routing equipment does not support IPv4 fragmentation) or the routing equipment fragments the message in the transmission process of the message is avoided, the data transmission service is prevented from being abnormal to a certain extent, and the data transmission efficiency is improved.
Further, the processor 1001 may invoke a routing program stored in the memory 1005, and also perform the following operations:
generating a routing information message according to a local routing table;
and filling the local router MTU value information into the routing information message, and sending the routing information message to the adjacent router of the local router.
In this embodiment, the above steps are processes of sending the routing information of the router. For example, routers using OSPF exchange and store link information of the entire network with each other, thereby grasping the topology of the entire network and independently calculating routes. OSPF is a typical link-state routing protocol, and is currently widely used in the second edition of OSPF, the latest standard being RFC 2328. That is, in the process of sending all the routing information stored in the routing table of the router to the router adjacent to the router, before sending the routing information, the MTU information of the router is filled into the routing information (the existing router exchange routing information using OSPF does not include the MTU value information of the router), and then the routing information is sent to the router adjacent to the router together. The information contained in the routing information packet generated in the present invention is shown in table 1.
TABLE 1
Figure BDA0001299979410000061
Wherein, RA to RD are routers, and N1 to N4 are networks.
In this embodiment, when sending the routing information packet of the router, the MTU value information of the router is filled into the routing information packet, so that each MTU value of the router on the entire network transmission link can know each other, and thus when performing subsequent routing, the PMTU value of each path is used as a factor for routing, and a route with the PMTU value greater than or equal to the length of the packet is preferentially selected, thereby avoiding occurrence of a situation that the transmission rate is affected (the routing device supports IPv4 fragmentation) because the packet length is greater than the MTU value of the routing device is discarded (the routing device does not support IPv4 fragmentation) or the routing device fragments the packet during transmission of the packet, and avoiding occurrence of an abnormality in the data transmission service to a certain extent.
Further, the processor 1001 may invoke a routing program stored in the memory 1005, and also perform the following operations:
receiving a routing information message sent by an adjacent router, and detecting whether the routing information message contains MTU value information of the adjacent router;
if the routing information message contains the MTU value information of the adjacent router, the routing information message is stored to a local routing table, and the local routing table information is calculated and updated according to the routing information message.
In this embodiment, the above step is a process of receiving a routing information packet sent by an adjacent router and updating a routing table of the router. For example, a router a has its own MTU value of 1300, and routers adjacent to it are a router b, a router c, and a router d, respectively. The router a receives the routing information from the router b, the router c, and the router d, respectively. If detecting according to the routing information: the MTU value of router b is 1200, the MTU value of router c is unknown, and the MTU value of router d is 1500. Then, the router routing table information is updated, the PMTU value of the a-to-b path is 1200, the PMTU value of the a-to-c path is 0, and the PMTU value of the a-to-d path is 1300.
In this embodiment, a routing information message including MTU value information of adjacent routers and sent by adjacent routers is received, and PMTU value information of each path between adjacent routers is obtained according to the MTU value information of the adjacent routers, so that PMTU value information of each path of the entire network link is known, and thus, when performing subsequent routing, the PMTU value of each path is used as a factor for routing, and a route with a PMTU value greater than or equal to the length of the message is preferentially selected, thereby avoiding occurrence of a situation that a transmission rate is affected (the routing device supports IPv4 fragmentation) because the length of the message is greater than the MTU value of the routing device and discarded (the routing device does not support IPv4 fragmentation) or the routing device fragments the message, and avoiding occurrence of an abnormality in a data transmission service to a certain extent.
Further, the processor 1001 may invoke a routing program stored in the memory 1005, and also perform the following operations:
if the routing information message does not contain the MTU value information of the adjacent router, the routing information message is stored in a local routing table, the information of the local routing table is calculated and updated according to the routing information message, and the MTU value of the adjacent router in the local routing table is set to be zero.
In this embodiment, the router receives a routing information packet sent by an adjacent router, and if it is detected that the routing information packet sent by an adjacent router c does not include the MTU value of the router c, that is, the MTU value of the router c is unknown, the PMTU value of the path from the router to the router c is unknown, the router table information of the router is calculated and updated according to the received routing information packet, and the MTU value of the adjacent router is set to zero in the router table.
In this embodiment, when the routing information message received by the router and sent by the neighboring router does not include the MTU value of the neighboring router, that is, the PMTU value of the path from the router to the neighboring router is unknown, the MTU value of the neighboring router is set to zero in the routing table, and then during routing, it is known that the PMTU value of the path from the router to the neighboring router is zero according to the routing table information.
Further, the processor 1001 may invoke a routing program stored in the memory 1005, and also perform the following operations:
if no target route with the PMTU value larger than or equal to the message length exists, determining the route of the optimal path in all routes corresponding to the route information according to a preset routing algorithm;
and forwarding the message according to the route of the optimal path.
In this embodiment, for example, when the message length L is 1500 bytes, if the PMTU values of all paths in the network path are less than 1500 bytes, that is, there is no route with a PMTU value greater than or equal to the message length L, the route of the optimal path is determined according to a preset algorithm and the route information. In this embodiment, the parameters considered for "optimal routing" include parameters such as the number of hops (the travel of a packet from one router or intermediate node to another in the network), the delay, and the time taken for the packet to communicate. In this embodiment, the preset routing algorithm may be an LS algorithm, a Dijkstra algorithm, a link vector routing algorithm, and the like, which is not limited herein and is specifically selected according to actual needs. In this embodiment, the route of the optimal path is determined according to the preset algorithm and the route information. For example, the route of the optimal path determined according to the preset routing algorithm is a path e, an interface and a next hop are determined according to the information of the path e and the position of the route in the path e, and the message is forwarded according to the outgoing interface and the next hop.
In this embodiment, when there is no route with a PMTU value greater than or equal to the message length L, the route of the optimal path is determined according to the preset routing algorithm and the routing information, which ensures the integrity of the scheme of the present invention, so that the scheme of the present invention is still effective and feasible when the PMTU values of all paths in the network path are less than the message length L.
Further, the processor 1001 may invoke a routing program stored in the memory 1005, and also perform the following operations:
detecting whether at least two routes with different PMTU values exist according to the routing information;
and if at least two routes with different PMTU values exist, detecting whether a target route with a PMTU value larger than or equal to the message length exists in the at least two routes with different PMTU values.
In this embodiment, when a message with a length of L is transmitted to the router, an interface and a next hop need to be determined for the message. According to the destination IP of the packet, the routing information corresponding to the IP is searched in the routing table stored in the router, for example, the routing information corresponding to the IP (i.e., the transmission path corresponding to the IP) is searched in the routing table stored in the router as path a, path b, and path c. And if the PMTU values of the path a, the path b and the path c are different, further detecting whether a route with the PMTU value larger than or equal to the message length L exists.
In this embodiment, before determining the route of the optimal path, it is determined whether a route with a PMTU value greater than or equal to the message length exists, and a route with a PMTU value greater than or equal to the message length is preferentially selected, so that a situation that a transmission rate is affected (a routing device supports IPv4 fragmentation) because the message length is greater than the MTU value of the routing device and is discarded (the routing device does not support IPv4 fragmentation) or the routing device fragments the message during transmission of the message is avoided, and an anomaly of a data transmission service is avoided to a certain extent.
Further, the processor 1001 may invoke a routing program stored in the memory 1005, and also perform the following operations:
if at least two routes with different PMTU values do not exist, determining the route of the optimal path in all routes corresponding to the route information according to a preset routing algorithm;
determining an output interface and a next hop corresponding to the route of the optimal path according to the route of the optimal path;
and forwarding the message according to the outgoing interface and the next hop.
In this embodiment, when a message with a length of L is transmitted to the router, an interface and a next hop need to be determined for the message. According to the destination IP of the packet, the routing information corresponding to the IP is searched in the routing table stored in the router, for example, the routing information corresponding to the IP (i.e., the transmission path corresponding to the IP) is searched in the routing table stored in the router as path a, path b, and path c. When at least two routes with different PMTU values do not exist (namely the PMTU values of the paths a, b and c are the same), the route of the optimal path is determined directly according to the routing information (the routing information of the paths a, b and c) and a preset routing algorithm no matter whether the PMTU value is larger than or equal to the message length or smaller than the message length.
In this embodiment, the routing algorithm is a routing algorithm, and the purpose of the algorithm is to find a route from a source router to a destination router (i.e., from the router to a receiving end a corresponding to a message destination IP) on an optimal path. Parameters considered for "optimal routing" include such things as the number of hops (the travel of a packet from one router or intermediate node to another in the network), latency, and the time it takes for the packet to transmit traffic. In this embodiment, the preset routing algorithm may be an LS algorithm, a Dijkstra algorithm, a link vector routing algorithm, and the like, which is not limited herein and is specifically selected according to actual needs. For example, the route of the optimal path determined according to the preset routing algorithm is a path e, an interface and a next hop are determined according to the information of the path e and the position of the route in the path e, and the message is forwarded according to the outgoing interface and the next hop.
In this embodiment, when there are no at least two routes with different PMTU values, the route of the optimal path is determined according to the preset routing algorithm and the routing information, which ensures the integrity of the scheme of the present invention, so that the scheme of the present invention is still effective and feasible when the PMTU values of all paths in the network path are consistent.
Referring to fig. 2, fig. 2 is a flowchart illustrating a routing method according to a first embodiment of the present invention.
In one embodiment, a routing method comprises:
step S10, receiving the message, extracting the destination IP and the message length corresponding to the message;
in this embodiment, the message refers to a data unit exchanged and transmitted in the network, and includes complete data information to be sent. When the router receives the message, the destination IP corresponding to the message is extracted, for example, the destination IP of the message is a receiving end a, and the length of the message is L.
Step S20, according to the destination IP, searching the route information corresponding to the destination IP in a preset route table;
according to the destination IP corresponding to the packet, for example, if the destination IP of the packet is the receiving end a, the routing information from the router to the receiving end a (i.e., the transmission path from the router to the receiving end a) is searched in the preset routing table. As shown in fig. 3, fig. 3 is a schematic view of an embodiment of a transmission path from the router to the receiving end a. In one embodiment, there are 3 pieces of routing information from the router to the receiving end a.
Step S30, detecting whether a target route with a PMTU value larger than or equal to the message length exists according to the route information;
in this embodiment, if there are 3 pieces of routing information from the router to the receiving end a, the PMTU values corresponding to the five pieces of routing information are: path a, 1000 bytes; path b, 1200 bytes; path c, 1300 bytes; path d, 1400 bytes; path e, 1500 bytes. If the message length L is 1300 bytes, the PMTU values of three paths of the path c, the path d and the path e are more than or equal to the message length L.
Step S40, if a target route with PMTU value larger than or equal to the message length exists, determining the route of the optimal path in the target route according to a preset routing algorithm;
in this embodiment, when it is detected that a route with a PMTU value greater than or equal to the message length L exists, for example, the message length L is 1300 bytes, and PMTU values of three paths, namely, path c (the PMTU value is 1300 bytes), path d (the PMTU value is 1400 bytes) and path e (the PMTU value is 1500 bytes), are greater than or equal to the message length L, the route of the optimal path is determined among the three paths, namely, path c, path d and path e, according to a preset routing algorithm. In this embodiment, the routing algorithm is a routing algorithm, and the purpose of the algorithm is to find a route from a source router to a destination router (i.e., from the router to a receiving end a corresponding to a message destination IP) on an optimal path. Parameters considered for "optimal routing" include such things as the number of hops (the travel of a packet from one router or intermediate node to another in the network), latency, and the time it takes for the packet to transmit traffic. In this embodiment, the preset routing algorithm may be an LS algorithm, a Dijkstra algorithm, a link vector routing algorithm, and the like, which is not limited herein and is specifically selected according to actual needs.
In this embodiment, when the PMTU value is greater than or equal to the message length L in a plurality of paths, a route of an optimal path is determined according to a preset routing algorithm. For example, the route of the optimal path determined according to the preset routing algorithm is a path e, an interface and a next hop are determined according to the information of the path e and the position of the route in the path e, and the message is forwarded according to the outgoing interface and the next hop.
In the invention, when a message is received, a destination IP and a message length corresponding to the message are extracted, a route with a PMTU (Path MTU) value larger than or equal to the message length corresponding to the destination IP is searched in a routing table according to the destination IP and the message length, in the route with the PMTU value larger than or equal to the message length, the route of an optimal path is determined according to a routing algorithm, and the message is forwarded according to the route of the optimal path. In the invention, the PMTU value is used as a factor to be added into a routing algorithm, and the route with the PMTU value larger than or equal to the message length is preferentially selected, so that the condition that the message transmission rate is influenced (the routing equipment supports IPv4 fragmentation) because the message length is larger than the MTU value of the routing equipment and is discarded (the routing equipment does not support IPv4 fragmentation) or the routing equipment fragments the message in the transmission process of the message is avoided, and the abnormity of the data transmission service is avoided to a certain extent.
Further, in an alternative embodiment of the present invention, step S10 is preceded by:
generating a routing information message according to a local routing table;
and filling the local router MTU value information into the routing information message, and sending the routing information message to the adjacent router of the local router.
In this embodiment, the above steps are processes of sending the routing information of the router. For example, routers using OSPF exchange and store link information of the entire network with each other, thereby grasping the topology of the entire network and independently calculating routes. OSPF is a typical link-state routing protocol, and is currently widely used in the second edition of OSPF, the latest standard being RFC 2328. That is, in the process of sending all the routing information stored in the routing table of the router to the router adjacent to the router, before sending the routing information, the MTU information of the router is filled into the routing information (the existing router exchange routing information using OSPF does not include the MTU value information of the router), and then the routing information is sent to the router adjacent to the router together. The information contained in the routing information packet generated in the present invention is shown in table 1.
TABLE 1
Figure BDA0001299979410000121
Wherein, RA to RD are routers, and N1 to N4 are networks.
In this embodiment, when sending the routing information packet of the router, the MTU value information of the router is filled into the routing information packet, so that each MTU value of the router on the entire network transmission link can know each other, and thus when performing subsequent routing, the PMTU value of each path is used as a factor for routing, and a route with the PMTU value greater than or equal to the length of the packet is preferentially selected, thereby avoiding occurrence of a situation that the transmission rate is affected (the routing device supports IPv4 fragmentation) because the packet length is greater than the MTU value of the routing device is discarded (the routing device does not support IPv4 fragmentation) or the routing device fragments the packet during transmission of the packet, and avoiding occurrence of an abnormality in the data transmission service to a certain extent.
Further, in an optional embodiment of the present invention, step S10 is preceded by:
receiving a routing information message sent by an adjacent router, and detecting whether the routing information message contains MTU value information of the adjacent router;
if the routing information message contains the MTU value information of the adjacent router, the routing information message is stored to a local routing table, and the local routing table information is calculated and updated according to the routing information message.
In this embodiment, the above step is a process of receiving a routing information packet sent by an adjacent router and updating a routing table of the router. For example, a router a has its own MTU value of 1300, and routers adjacent to it are a router b, a router c, and a router d, respectively. The router a receives the routing information from the router b, the router c, and the router d, respectively. If detecting according to the routing information: the MTU value of router b is 1200, the MTU value of router c is unknown, and the MTU value of router d is 1500. Then, the router routing table information is updated, the PMTU value of the a-to-b path is 1200, the PMTU value of the a-to-c path is 0, and the PMTU value of the a-to-d path is 1300.
In this embodiment, a routing information message including MTU value information of adjacent routers and sent by adjacent routers is received, and PMTU value information of each path between adjacent routers is obtained according to the MTU value information of the adjacent routers, so that PMTU value information of each path of the entire network link is known, and thus, when performing subsequent routing, the PMTU value of each path is used as a factor for routing, and a route with a PMTU value greater than or equal to the length of the message is preferentially selected, thereby avoiding occurrence of a situation that a transmission rate is affected (the routing device supports IPv4 fragmentation) because the length of the message is greater than the MTU value of the routing device and discarded (the routing device does not support IPv4 fragmentation) or the routing device fragments the message, and avoiding occurrence of an abnormality in a data transmission service to a certain extent.
Further, in another optional embodiment of the present invention, the routing method further includes:
if the routing information message does not contain the MTU value information of the adjacent router, the routing information message is stored in a local routing table, the information of the local routing table is calculated and updated according to the routing information message, and the MTU value of the adjacent router in the local routing table is set to be zero.
In this embodiment, the router receives a routing information packet sent by an adjacent router, and if it is detected that the routing information packet sent by an adjacent router c does not include the MTU value of the router c, that is, the MTU value of the router c is unknown, the PMTU value of the path from the router to the router c is unknown, the router table information of the router is calculated and updated according to the received routing information packet, and the MTU value of the adjacent router is set to zero in the router table.
In this embodiment, when the routing information message received by the router and sent by the neighboring router does not include the MTU value of the neighboring router, that is, the PMTU value of the path from the router to the neighboring router is unknown, the MTU value of the neighboring router is set to zero in the routing table, and then during routing, it is known that the PMTU value of the path from the router to the neighboring router is zero according to the routing table information.
Referring to fig. 4, fig. 4 is a flowchart illustrating a routing method according to a second embodiment of the present invention.
In one embodiment, step S30 is followed by:
step S60, if there is no target route with PMTU value greater than or equal to the message length, determining the route of the optimal path in all routes corresponding to the route information according to the preset routing algorithm;
and step S70, forwarding the message according to the route of the optimal path.
In this embodiment, for example, when the message length L is 1500 bytes, if the PMTU values of all paths in the network path are less than 1500 bytes, that is, there is no route with a PMTU value greater than or equal to the message length L, the route of the optimal path is determined according to a preset algorithm and the route information. In this embodiment, the parameters considered for "optimal routing" include parameters such as the number of hops (the travel of a packet from one router or intermediate node to another in the network), the delay, and the time taken for the packet to communicate. In this embodiment, the preset routing algorithm may be an LS algorithm, a Dijkstra algorithm, a link vector routing algorithm, and the like, which is not limited herein and is specifically selected according to actual needs. In this embodiment, the route of the optimal path is determined according to the preset algorithm and the route information. For example, the route of the optimal path determined according to the preset routing algorithm is a path e, an interface and a next hop are determined according to the information of the path e and the position of the route in the path e, and the message is forwarded according to the outgoing interface and the next hop.
In this embodiment, when there is no route with a PMTU value greater than or equal to the message length L, the route of the optimal path is determined according to the preset routing algorithm and the routing information, which ensures the integrity of the scheme of the present invention, so that the scheme of the present invention is still effective and feasible when the PMTU values of all paths in the network path are less than the message length L.
Referring to fig. 5, fig. 5 is a detailed flowchart of step S30 in fig. 2.
In one embodiment, step S30 includes:
step S301, detecting whether at least two routes with different PMTU values exist according to the route information;
step S302, if at least two routes with different PMTU values exist, whether a target route with a PMTU value larger than or equal to the message length exists in the at least two routes with different PMTU values is detected.
In this embodiment, when a message with a length of L is transmitted to the router, an interface and a next hop need to be determined for the message. According to the destination IP of the packet, the routing information corresponding to the IP is searched in the routing table stored in the router, for example, the routing information corresponding to the IP (i.e., the transmission path corresponding to the IP) is searched in the routing table stored in the router as path a, path b, and path c. And if the PMTU values of the path a, the path b and the path c are different, further detecting whether a route with the PMTU value larger than or equal to the message length L exists.
In this embodiment, before determining the route of the optimal path, it is determined whether a route with a PMTU value greater than or equal to the message length exists, and a route with a PMTU value greater than or equal to the message length is preferentially selected, so that a situation that a transmission rate is affected (a routing device supports IPv4 fragmentation) because the message length is greater than the MTU value of the routing device and is discarded (the routing device does not support IPv4 fragmentation) or the routing device fragments the message during transmission of the message is avoided, and an anomaly of a data transmission service is avoided to a certain extent.
Further, in another optional embodiment of the present invention, step S301 is followed by including;
if at least two routes with different PMTU values do not exist, determining the route of the optimal path in all routes corresponding to the route information according to a preset routing algorithm;
determining an output interface and a next hop corresponding to the route of the optimal path according to the route of the optimal path;
and forwarding the message according to the outgoing interface and the next hop.
In this embodiment, when a message with a length of L is transmitted to the router, an interface and a next hop need to be determined for the message. According to the destination IP of the packet, the routing information corresponding to the IP is searched in the routing table stored in the router, for example, the routing information corresponding to the IP (i.e., the transmission path corresponding to the IP) is searched in the routing table stored in the router as path a, path b, and path c. When at least two routes with different PMTU values do not exist (namely the PMTU values of the paths a, b and c are the same), the route of the optimal path is determined directly according to the routing information (the routing information of the paths a, b and c) and a preset routing algorithm no matter whether the PMTU value is larger than or equal to the message length or smaller than the message length.
In this embodiment, the routing algorithm is a routing algorithm, and the purpose of the algorithm is to find a route from a source router to a destination router (i.e., from the router to a receiving end a corresponding to a message destination IP) on an optimal path. Parameters considered for "optimal routing" include such things as the number of hops (the travel of a packet from one router or intermediate node to another in the network), latency, and the time it takes for the packet to transmit traffic. In this embodiment, the preset routing algorithm may be an LS algorithm, a Dijkstra algorithm, a link vector routing algorithm, and the like, which is not limited herein and is specifically selected according to actual needs. For example, the route of the optimal path determined according to the preset routing algorithm is the path e, the interface and the next hop are determined according to the information of the path e and the position of the route in the path e, and the message is sent according to the outgoing interface and the next hop
In this embodiment, when there are no at least two routes with different PMTU values, the route of the optimal path is determined according to the preset routing algorithm and the routing information, which ensures the integrity of the scheme of the present invention, so that the scheme of the present invention is still effective and feasible when the PMTU values of all paths in the network path are consistent.
Furthermore, an embodiment of the present invention provides a computer-readable storage medium, where a routing program is stored on the computer-readable storage medium, and when executed by a processor, the routing program implements the steps of the routing method as described above.
The specific embodiment of the computer-readable storage medium of the present invention is basically the same as the embodiments of the routing method described above, and will not be described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (8)

1. A method for routing a route, the method comprising:
receiving a message, and extracting a target IP and a message length corresponding to the message;
according to the destination IP, searching the routing information corresponding to the destination IP in a preset routing table;
detecting whether a target route with a PMTU value larger than or equal to the message length exists according to the routing information;
if a target route with the PMTU value larger than or equal to the message length exists, determining the route of the optimal path in the target route according to a preset routing algorithm;
the receiving the message, before extracting the destination IP corresponding to the message and the message length, comprises:
generating a routing information message according to a local routing table;
and filling the local router MTU value information into the routing information message, and sending the routing information message to the adjacent router of the local router.
2. The routing method of claim 1, wherein before receiving the packet and extracting the destination IP and the packet length corresponding to the packet, the method further comprises:
receiving a routing information message sent by an adjacent router, and detecting whether the routing information message contains MTU value information of the adjacent router;
if the routing information message contains the MTU value information of the adjacent router, the routing information message is stored to a local routing table, and the local routing table information is calculated and updated according to the routing information message.
3. The routing method of claim 2, wherein the receiving the routing information packet sent by the neighboring router, and detecting whether the routing information packet includes MTU value information of the neighboring router comprises:
if the routing information message does not contain the MTU value information of the adjacent router, the routing information message is stored in a local routing table, the information of the local routing table is calculated and updated according to the routing information message, and the MTU value of the adjacent router in the local routing table is set to be zero.
4. The method according to claim 1, wherein the detecting whether there is a target route with a PMTU value greater than or equal to the packet length according to the routing information comprises:
if no target route with the PMTU value larger than or equal to the message length exists, determining the route of the optimal path in all routes corresponding to the route information according to a preset routing algorithm;
and forwarding the message according to the route of the optimal path.
5. The route selecting method according to claim 1, wherein the detecting whether there is a target route with a PMTU value greater than or equal to the message length according to the routing information comprises:
detecting whether at least two routes with different PMTU values exist according to the routing information;
and if at least two routes with different PMTU values exist, detecting whether a target route with a PMTU value larger than or equal to the message length exists in the at least two routes with different PMTU values.
6. The routing method of claim 5, wherein the detecting whether there are at least two routes with different PMTU values according to the routing information comprises:
if at least two routes with different PMTU values do not exist, determining the route of the optimal path in all routes corresponding to the route information according to a preset routing algorithm;
determining an output interface and a next hop corresponding to the route of the optimal path according to the route of the optimal path;
and forwarding the message according to the outgoing interface and the next hop.
7. A route routing device, characterized in that the route routing device comprises: a memory, a processor, and a routing program stored on the memory and executable on the processor, the routing program when executed by the processor implementing the steps of:
receiving a message, and extracting a target IP and a message length corresponding to the message;
according to the destination IP, searching the routing information corresponding to the destination IP in a preset routing table;
detecting whether a target route with a PMTU value larger than or equal to the message length exists according to the routing information;
if a target route with the PMTU value larger than or equal to the message length exists, determining the route of the optimal path in the target route according to a preset routing algorithm;
the routing program, when executed by the processor, further performs the steps of:
generating a routing information message according to a local routing table;
and filling the local router MTU value information into the routing information message, and sending the routing information message to the adjacent router of the local router.
8. A computer-readable storage medium, characterized in that a routing program is stored on the computer-readable storage medium, which when executed by a processor implements the steps of the routing method according to any of claims 1 to 6.
CN201710361783.XA 2017-05-19 2017-05-19 Routing method, device and computer readable storage medium Active CN108965122B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710361783.XA CN108965122B (en) 2017-05-19 2017-05-19 Routing method, device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710361783.XA CN108965122B (en) 2017-05-19 2017-05-19 Routing method, device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN108965122A CN108965122A (en) 2018-12-07
CN108965122B true CN108965122B (en) 2022-03-11

Family

ID=64463082

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710361783.XA Active CN108965122B (en) 2017-05-19 2017-05-19 Routing method, device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN108965122B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110177045B (en) * 2019-05-15 2021-04-02 浙江启程电子科技股份有限公司 MTU value-based transmission data configuration method
CN112333094B (en) * 2020-11-27 2022-10-18 迈普通信技术股份有限公司 Data transmission processing method and device, network equipment and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101577709A (en) * 2008-08-06 2009-11-11 中兴通讯股份有限公司 IP packet multiplexing method and equipment capable of avoiding fragmentation
CN101977156A (en) * 2010-11-18 2011-02-16 北京星网锐捷网络技术有限公司 Method, device and routing equipment for learning maximum transmission unit
CN102325076A (en) * 2011-05-24 2012-01-18 中兴通讯股份有限公司 Method for discovering PMTU (Path Maximum Transfer Unit) and node
CN102868609A (en) * 2012-09-27 2013-01-09 中兴通讯股份有限公司 Maximum transmission unit consultation method and data terminal

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030046336A1 (en) * 2001-08-31 2003-03-06 D'annunzio Michael A. Persistent link for broadband mobile platform communicatons systems using proxy servers
US8107498B2 (en) * 2006-03-31 2012-01-31 Panasonic Corporation Network relay apparatus, data receiving apparatus, data transmitting apparatus, multipath MTU finding method and multipath MTU finding system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101577709A (en) * 2008-08-06 2009-11-11 中兴通讯股份有限公司 IP packet multiplexing method and equipment capable of avoiding fragmentation
CN101977156A (en) * 2010-11-18 2011-02-16 北京星网锐捷网络技术有限公司 Method, device and routing equipment for learning maximum transmission unit
CN102325076A (en) * 2011-05-24 2012-01-18 中兴通讯股份有限公司 Method for discovering PMTU (Path Maximum Transfer Unit) and node
CN102868609A (en) * 2012-09-27 2013-01-09 中兴通讯股份有限公司 Maximum transmission unit consultation method and data terminal

Also Published As

Publication number Publication date
CN108965122A (en) 2018-12-07

Similar Documents

Publication Publication Date Title
KR102555671B1 (en) Packet processing methods, related devices and computer storage media
US11431633B2 (en) Label forwarding entry generation method and apparatus, packet sending method and apparatus, and device
WO2018000443A1 (en) Service function chaining (sfc)-based packet forwarding method, device and system
US10148573B2 (en) Packet processing method, node, and system
US10021023B2 (en) Packet forwarding method, controller, forwarding device, and network system
US20170005882A1 (en) Service Chain Management Method, System and Device
CN102325076B (en) Method for discovering PMTU (Path Maximum Transfer Unit) and node
CN107342939B (en) Method and device for transmitting data
JP6085263B2 (en) Relay node and route control method
CN112671641B (en) Message forwarding method and device
US20170149685A1 (en) Address information publishing method and apparatus
CN109714274B (en) Method for acquiring corresponding relation and routing equipment
US20120124238A1 (en) Prioritization of routing information updates
WO2017198131A1 (en) Method and system for redirecting data stream, and network device and control device
US20160065483A1 (en) Communication system, control apparatus, and storage medium
JP5725236B2 (en) Communication system, node, packet transfer method and program
US20150288595A1 (en) Control apparatus, communication system, control information creation method, and program
CN108965122B (en) Routing method, device and computer readable storage medium
US20220150167A1 (en) Bier packet processing method, network device, and system
FI127371B (en) Passive routing in a mesh network
CN111464441A (en) Communication method and device
JP2009135772A (en) Router device
KR102286466B1 (en) Method and system for providing function-based routing
JP5071245B2 (en) Packet switching apparatus and program
WO2016197832A1 (en) Packet processing method, device and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant