Movatterモバイル変換


[0]ホーム

URL:


CN109039918B - Message sending method and device - Google Patents

Message sending method and device
Download PDF

Info

Publication number
CN109039918B
CN109039918BCN201811273708.9ACN201811273708ACN109039918BCN 109039918 BCN109039918 BCN 109039918BCN 201811273708 ACN201811273708 ACN 201811273708ACN 109039918 BCN109039918 BCN 109039918B
Authority
CN
China
Prior art keywords
message
tunnel
gre
address
tunnel table
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
CN201811273708.9A
Other languages
Chinese (zh)
Other versions
CN109039918A (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.)
Hangzhou H3C Technologies Co Ltd
Original Assignee
Hangzhou H3C Technologies Co Ltd
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 Hangzhou H3C Technologies Co LtdfiledCriticalHangzhou H3C Technologies Co Ltd
Priority to CN201811273708.9ApriorityCriticalpatent/CN109039918B/en
Publication of CN109039918ApublicationCriticalpatent/CN109039918A/en
Application grantedgrantedCritical
Publication of CN109039918BpublicationCriticalpatent/CN109039918B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The embodiment of the application provides a message sending method and a device, wherein the message sending method comprises the following steps: inquiring a first tunnel table by using a destination address of a message to be sent; if the first tunnel table item matched with the destination address of the message to be sent does not exist, determining the target application type of the message to be sent; querying a second tunnel table with the target application type; and if a second tunnel table item matched with the target application type exists, transmitting the message to be transmitted by using the second tunnel table item. According to the technical scheme, the second tunnel table records the application type of the message received by the central node and the tunnel source address for sending the message, when the central node needs to send a response message aiming at the received asymmetric IP service message, the tunnel table item matched with the application type of the message to be sent can be inquired from the second tunnel table, and then the message to be sent is sent by adopting the tunnel table item.

Description

Message sending method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for sending a packet.
Background
The GRE (Generic Routing Encapsulation) Protocol is used to encapsulate data packets of other protocols such as IP (Internet Protocol), MPLS (Multiprotocol Label Switching), and ethernet, and transmit the encapsulated data packets in a GRE tunnel. The encapsulated data message is a GRE message. GRE tunnels include both point-to-point and point-to-multipoint connection types. Wherein the point-to-multipoint GRE tunnel is capable of providing virtual connectivity of one central node to a plurality of branch nodes.
After receiving the GRE message sent by the branch node, the central node acquires a tunnel source IP address of a transmission protocol message header (an encapsulation layer IP header) and a message source IP address of a passenger protocol message header (an inner layer IP header) from the GRE message, determines the tunnel source IP address as a tunnel destination IP address, determines the message source IP address as a message destination IP address, and determines the tunnel destination IP address and the message destination IP address as a corresponding relation.
The central node stores a GRE tunnel table, the GRE tunnel table comprises a plurality of GRE tunnel table entries, and each GRE tunnel table entry records the corresponding relation between a tunnel destination IP address and a message destination IP address. After determining the corresponding relation between the tunnel destination IP address and the message destination IP address from the GRE message, the central node inquires whether a GRE tunnel table entry of the corresponding relation exists in the GRE tunnel table, if not, the corresponding relation establishes a GRE tunnel table entry, and the established GRE tunnel table entry is stored in the GRE tunnel table.
When the central node needs to send a data message to the branch node through the GRE tunnel, the central node determines a destination address of the data message to be sent, namely a message destination IP address, and inquires whether a GRE tunnel table entry of the message destination IP address exists in the GRE tunnel table, if so, the central node determines the tunnel destination IP address according to the GRE tunnel table entry, encapsulates the data message into the GRE message by using the tunnel destination IP address, and sends the GRE message.
Generally, the services processed by the central node are IP symmetric, and the messages for such services are also IP symmetric. For example, the GRE message received by the central node is a GRE request message, and the GRE message sent by the central node is a GRE response message. The GRE request message and the GRE response message are IP symmetric messages, that is: the tunnel source IP address of the GRE request message is the same as the tunnel destination IP address of the GRE response message, the source IP address of the inner layer message in the GRE request message is the same as the destination IP address of the inner layer message in the GRE response message, the tunnel destination IP address of the GRE request message is the same as the tunnel source IP address of the GRE response message, and the destination IP address of the inner layer message in the GRE request message is the same as the source IP address of the inner layer message in the GRE response message.
However, the central node also handles asymmetric IP traffic, such as IPv6 address collision detection, OSPF (Open Shortest Path First) traffic, and the like. When the central node receives the GRE message of the asymmetric IP service sent by the branch node, the central node establishes a GRE tunnel table entry according to the GRE message of the asymmetric IP service. When the central node sends the GRE message of the asymmetric IP service to the device, the destination IP address of the inner layer message in the GRE message is different from the destination IP address of the message in the GRE tunnel table entry, so that the destination IP address of the tunnel cannot be obtained, and the central node cannot send the GRE message through the GRE tunnel.
Taking fig. 3 as an example, device a is a device serving as a central node, device B is a branch node, the tunnel interface of device a is configured with IPv6 addresses of 1111::1111, and when the tunnel interface of device B is configured with IPv6 addresses of 1111::1111, device B sends an ns (neighbor solicitation) message to perform IPv6 address collision detection. The device B encapsulates the NS message firstly, and as for the encapsulated NS message, the tunnel source IP address is 2.0.0.1, the tunnel destination IP address is 1.0.0.1, the source IP address of the NS message is as follows, the destination IP address of the NS message is ff02, 1: ff00:1111 (multicast address), and the device A establishes a GRE tunnel table entry after receiving the encapsulated NS message: the destination IP address of the message is 2.0.0.1. When the device a feeds back an NA (neighbor advertisement) message to the device B, the source address of the NA message is 1111::1111, and the destination address is ff02::1 (multicast address), and the destination address cannot be matched in the GRE tunnel table entry established by the device a (ff02::1), so that the device a cannot acquire the destination IP address of the tunnel, and further the device a cannot send the NA message to the device B.
Therefore, how to acquire the tunnel destination address of the GRE packet of the asymmetric IP service by the central node is an urgent problem to be solved.
Disclosure of Invention
An object of the embodiments of the present application is to provide a message sending method and an apparatus, so as to solve a problem that a central node cannot acquire a tunnel destination address of a GRE message of an asymmetric IP service, and thus cannot send the GRE message. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a packet sending method, which is applied to a central node, and the method includes:
inquiring a first tunnel table by using a destination address of a message to be sent;
if the first tunnel table item matched with the destination address of the message to be sent does not exist, determining the target application type of the message to be sent;
querying a second tunnel table by using the target application type, wherein the second tunnel table is established according to the application type of an inner layer message in the GRE message sent by the branch node and a tunnel source address for sending the GRE message;
and if a second tunnel table item matched with the target application type exists, transmitting the message to be transmitted by using the second tunnel table item.
Optionally, the method further comprises:
receiving a GRE message sent by a branch node, and judging whether the GRE message meets a preset condition;
if yes, acquiring the application type of an inner layer message in the GRE message and a tunnel source address for sending the GRE message;
and establishing a corresponding tunnel table entry according to the acquired application type and the tunnel source address, setting aging time for the tunnel table entry, and maintaining the aging time in a second tunnel table.
Optionally, when the message to be sent is sent by using the second tunnel table entry, the method further includes:
and resetting the aging time of the second tunnel table entry matched with the target application type to a preset default value.
Optionally, the step of determining whether the GRE packet meets a preset condition includes:
acquiring a destination address of an inner layer message in the received GRE message;
judging whether the obtained destination address is any one of the address of the central node, a multicast address matched with the address of the central node and a broadcast address;
if yes, the received GRE message is determined to meet the preset condition.
Optionally, the step of sending the message to be sent by using the second tunnel table entry includes:
if the number of the second tunnel table entries is multiple, GRE encapsulation is respectively carried out on the message to be sent by using the tunnel address in each second tunnel table entry, so as to obtain each GRE message with different tunnel destination addresses;
and respectively sending each GRE message obtained after encapsulation through a corresponding GRE tunnel.
In a second aspect, an embodiment of the present application provides a packet sending apparatus, which is applied to a central node, where the apparatus includes:
the first query module is used for querying a first tunnel table by using a destination address of a message to be sent;
the first determining module is used for determining the target application type of the message to be sent if a first tunnel table item matched with the destination address of the message to be sent does not exist;
the second query module is used for querying a second tunnel table by using the target application type, wherein the second tunnel table is established according to the application type of an inner layer message in the GRE message sent by the branch node and a tunnel source address for sending the GRE message;
and the sending module is used for sending the message to be sent by utilizing a second tunnel table item if the second tunnel table item matched with the target application type exists.
Optionally, the apparatus further comprises:
the judging module is used for receiving the GRE message sent by the branch node and judging whether the GRE message meets a preset condition;
the obtaining module is used for obtaining the application type of the inner layer message in the GRE message and the tunnel source address for sending the GRE message when the judgment result of the judging module is yes;
and the establishing module is used for establishing a corresponding tunnel table entry according to the acquired application type and the tunnel source address, setting aging time for the tunnel table entry and maintaining the tunnel table entry in a second tunnel table.
Optionally, the apparatus further comprises:
and the resetting module is used for resetting the aging time of the second tunnel table entry matched with the target application type to a preset default value.
Optionally, the determining module is specifically configured to:
acquiring a destination address of an inner layer message in the received GRE message, and judging whether the acquired destination address is any one of the address of the central node, a multicast address matched with the address of the central node and a broadcast address; if yes, the received GRE message is determined to meet the preset condition.
Optionally, the sending module is specifically configured to:
if the number of the second tunnel table entries is multiple, GRE encapsulation is respectively carried out on the message to be sent by using the tunnel address in each second tunnel table entry, so as to obtain each GRE message with different tunnel destination addresses; and respectively sending each GRE message obtained after encapsulation through a corresponding GRE tunnel.
In a third aspect, embodiments provide an electronic device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: implementing any of the above message sending method steps.
In a fourth aspect, embodiments of the present application provide a machine-readable storage medium storing machine-executable instructions that, when invoked and executed by a processor, cause the processor to: implementing any of the above message sending method steps.
In the technical scheme provided by the embodiment of the application, a first tunnel table is inquired by using a destination address of a message to be sent; if the first tunnel table item matched with the destination address of the message to be sent does not exist, determining the target application type of the message to be sent; querying a second tunnel table with the target application type; and if a second tunnel table item matched with the target application type exists, transmitting the message to be transmitted by using the second tunnel table item.
According to the technical scheme provided by the embodiment of the application, the second tunnel table is established by the center node according to the application type of the inner layer message in the received GRE message sent by the branch node and the tunnel source address sending the GRE message, and when the center node receives the GRE message of the asymmetric IP service, the mapping relation between the application type of the asymmetric IP service message in the GRE message and the source address of the GRE tunnel sending the GRE message is recorded in the second tunnel table, namely the corresponding tunnel table entry is established. For the central node, for a response packet of a service packet, the application types of the response packet sent by the central node and the received service packet are the same, so that when the central node responds to the received service packet, a packet to be sent of an asymmetric IP service needs to be sent, based on the unchanged application type, a second tunnel table entry matched with the application type of the packet to be sent can be queried from the second tunnel table, and the packet to be sent is sent by using the second tunnel table entry.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a message sending method according to an embodiment of the present application;
fig. 2 is another flowchart of a message sending method according to an embodiment of the present application;
fig. 3 is a schematic diagram of interaction between a central node and a branch node according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a message sending apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In order to solve the problem that a central node cannot acquire a tunnel destination address of a GRE packet of an asymmetric IP service, embodiments of the present application provide a packet sending method and apparatus, which are applied to the central node, where the packet sending method provided by the embodiments of the present application includes:
inquiring a first tunnel table by using a destination address of a message to be sent;
if the first tunnel table item matched with the destination address of the message to be sent does not exist, determining the target application type of the message to be sent;
querying a second tunnel table by using the target application type, wherein the second tunnel table is established according to the application type of an inner layer message in the GRE message sent by the branch node and a tunnel source address for sending the GRE message;
and if a second tunnel table item matched with the target application type exists, transmitting the message to be transmitted by using the second tunnel table item.
According to the technical scheme provided by the embodiment of the application, the second tunnel table is established by the center node according to the application type of the inner layer message in the received GRE message sent by the branch node and the tunnel source address sending the GRE message, and when the center node receives the GRE message of the asymmetric IP service, the mapping relation between the application type of the asymmetric IP service message in the GRE message and the source address of the GRE tunnel sending the GRE message is recorded in the second tunnel table, namely the corresponding tunnel table entry is established. For the central node, for a response packet of a service packet, the application types of the response packet sent by the central node and the received service packet are the same, so that when the central node responds to the received service packet, a packet to be sent of an asymmetric IP service needs to be sent, based on the unchanged application type, a second tunnel table entry matched with the application type of the packet to be sent can be queried from the second tunnel table, and the packet to be sent is sent by using the second tunnel table entry.
First, a method for sending a message provided in an embodiment of the present application is described below. The message sending method provided by the embodiment of the application is applied to a central node, the central node is configured with a GRE P2MP (point 2multiple point, point-to-multipoint master station) tunnel interface, and based on the GRE P2MP tunnel interface, the central node can establish a plurality of GRE tunnels with a plurality of branch nodes, that is, the GRE P2MP tunnel is established between the central node and the branch nodes. It can be considered that the central node is the P2MP side, i.e. one central node corresponds to a plurality of branch nodes, and the branch nodes are the P2P side, i.e. one branch node corresponds to only one central node.
The central node and the branch nodes can transmit GRE messages through the established GRE tunnels. The central node and the branch node can encapsulate the data message to be sent according to the GRE protocol to obtain the GRE message, and then the GRE message is sent through the GRE tunnel.
As shown in fig. 1, a message sending method provided in the embodiment of the present application includes the following steps.
S101, inquiring a first tunnel table by using a destination address of a message to be sent;
the message to be sent is a message sent from the center node to the branch node. It can be considered that the message received by the central node from the branch node corresponds to the message sent to the branch node, for example, the correspondence between the request message and the response message. Therefore, the message to be sent is a response message corresponding to the request message received by the central node from the branch node.
The first tunnel table is established according to the source address of the inner layer message in the GRE message sent by the branch node and the tunnel source address for sending the GRE message. The first tunnel table may include a plurality of first tunnel table entries, and each tunnel table entry records a correspondence between a source address of an inner layer packet in a GRE packet sent by the branch node and a tunnel source address of the GRE packet.
For example, if the source address of the inner layer message in the GRE message sent by the branch node is 10.1.1.2, and the source address of the tunnel sending the GRE message is 11.1.1.2, the following table 1 is recorded in the first tunnel table for the source address and the tunnel source address:
TABLE 1
Figure GDA0002887679620000081
Wherein, the first tunnel table may be stored in the central node in advance. For each first tunnel table entry, besides recording the corresponding relation, the aging time can be set. The aging time of the first tunnel table entry is used for representing the time length required for the first tunnel table entry to age, and the aging time is continuously reduced along with the time until the aging time becomes 0. When the aging time becomes 0, the first tunnel table entry is deleted from the first tunnel table. And the aging time is counted from the establishment of the first tunnel table entry.
For example, if the aging time of a first tunnel entry is 10 seconds, the aging time is counted from the establishment of the first tunnel entry, the aging time is continuously decreased from 10 seconds, and when the aging time becomes 0 second, the first tunnel entry is deleted.
By setting the aging time for the first tunnel table entries, each first tunnel table entry is only stored in the first tunnel table within the corresponding aging time, and once the aging time becomes 0, the first tunnel table entry is deleted, thereby releasing a certain storage space. Therefore, the storage space resources of the central node are saved.
S102, if the first tunnel table item matched with the destination address of the message to be sent does not exist, determining the target application type of the message to be sent.
There is no first tunnel table item matching with the destination address of the message to be sent, that is, the first tunnel table does not record the address identical to the destination address of the message to be sent, so that the corresponding tunnel source address cannot be found.
The implementation manner of determining the application type of the Message to be sent may be determined by port information in a TCP (Transmission Control Protocol) header or a UDP (User data Protocol) header, may also be determined by a type field or a code field of an ICMP (Internet Control Message Protocol) Message, and may also be determined by Protocol information of an IP (Internet Protocol) header.
For example, when the protocol information of the IP header of the message to be sent is 89, the determined application type is OSPF (Open short Path First, Open Shortest Path First); when the protocol information of the IP header of the message to be sent is 58 and the ICMP TYPE field is 135, the determined application TYPE is an ND (Neighbor Discovery protocol) protocol.
The determination method for the application type is not limited to the above three methods, and may also be determined by other methods, which are not described herein again.
S103, querying a second tunnel table by using the target application type.
The second tunnel table is established according to the application type of the inner layer message in the GRE message sent by the branch node and the tunnel source address for sending the GRE message. The second tunnel table may include a plurality of second tunnel table entries, where each second tunnel table entry records a corresponding relationship between an application type of an inner layer packet in a GRE packet sent by the branch node and a tunnel source address for sending the GRE packet.
For example, if the application type of the inner layer packet in the GRE packet received by the central node and sent by the branch node is OSPF, and the tunnel source address for sending the GRE packet is 2.0.0.1, the corresponding relationship between the application type recorded in the second tunnel table entry and the tunnel source address is as follows: OSPF corresponds to 2.0.0.1.
In the second tunnel table, there may be one second tunnel entry for the same application type, or there may be multiple second tunnel entries, that is, there are one or more second tunnel entries containing the same application type. Thus, one application type may correspond to one tunnel source address, and may also correspond to multiple tunnel source addresses.
For example, in the second tunnel table, the second tunnel table entry based on the application type OSPF includes: OSPF and the second tunnel entry of 2.0.0.1, OSPF and the second tunnel entry of 11.1.1.2, OSPF and the second tunnel entry of 11.1.1.24.
In an implementation manner of querying the second tunnel table by using the target application type, whether the target application type exists in the second tunnel table is queried, and if the target application type exists, it can be considered that a second tunnel table entry containing the target application type in the second tunnel table matches the target application type.
And S104, if a second tunnel table item matched with the target application type exists, transmitting the message to be transmitted by using the second tunnel table item.
And a second tunnel table entry matched with the target application type exists, namely the second tunnel table entry contains the target application type.
Specifically, a second tunnel table entry matched with the target application type is obtained from the second tunnel table, a tunnel source address is obtained from the second tunnel table entry, the obtained tunnel source address is used as a tunnel destination address for encapsulating the message to be sent, and the message to be sent is encapsulated by using the tunnel destination address.
And after the message to be sent is packaged, a GRE message based on the message to be sent can be obtained, and the tunnel destination address of the transmission protocol message header of the GRE message is the tunnel source address obtained from the second tunnel table. After obtaining the GRE message, the central node sends the GRE message to a tunnel destination address through a GRE tunnel. Thus, the central node completes sending the message to be sent through the GRE tunnel.
In one embodiment, if a plurality of second tunnel table entries matched with the target application type exist, GRE encapsulation is respectively performed on the message to be sent by using the tunnel address in each second tunnel table entry, so as to obtain GRE messages with different tunnel destination addresses; and respectively sending each GRE message obtained after encapsulation through a corresponding GRE tunnel.
For example, there are two second tunnel entries in the second tunnel table that match the target application type OSPF, and the tunnel addresses included in the two second tunnel entries are: 2.0.0.1 and 11.1.1.2. Then, GRE encapsulation is performed on the message to be sent by using 2.0.0.1, so that a GRE message based on the message to be sent can be obtained, and GRE encapsulation is performed on the message to be sent by using 11.1.1.2, so that another GRE message based on the message to be sent can be obtained. The central node sends a first GRE message through a GRE tunnel with 2.0.0.1 and a second GRE message through a GRE tunnel with 11.1.1.2.
The second tunnel table is established according to the application type of the inner layer message in the GRE message sent by the branch node and the tunnel source address sending the GRE message, and aiming at the establishment of the second tunnel table entry in the second tunnel table, in one implementation manner, the center node can receive the GRE message sent by the branch node, and the branch node sending the GRE message can be any branch node.
After receiving the GRE message, the central node can determine whether the GRE message meets a preset condition. The preset condition may be set by a user.
In one embodiment, the central node may obtain a destination address of an inner layer packet in the received GRE packet, and determine whether the obtained destination address is any one of an address of the central node, a multicast address and a broadcast address matched with the address of the central node; if so, the received GRE message can be determined to meet the preset condition, otherwise, the received GRE message can be determined to not meet the preset condition, and at the moment, the central node can forward the GRE message according to the destination address.
When the destination address of the inner layer message in the received GRE message is the address of the central node, it can be determined that the GRE message received by the central node meets the preset condition.
When the destination address of the inner layer message in the received GRE message is the multicast address matched with the address of the central node, the central node can be determined to be one of the devices receiving the inner layer message. The multicast address is a group of addresses for receiving the inner layer message, and the address of the central node is matched with the multicast address, namely the address of the central node is one of the multicast addresses.
For example, the destination address of the inner layer message in the received GRE message is ff02::1: ff00:1111, and the destination address is the multicast address of Ipv6, and as long as the last 24 bits of the address are 00:1111, the address can be regarded as one of the multicast addresses. When the address of the central node is 1111: 1111, it can be determined that 1111: 1111 is matched with ff02: 1: ff00:1111, that is, the address of the central node is one of the multicast addresses, and the GRE message received by the central node is determined to satisfy the preset condition.
When the destination address of the inner layer message in the received GRE message is a broadcast address, the address where the inner layer message is received can be considered to be one of the broadcast addresses, and it is further determined that the GRE message received by the central node meets the preset condition.
If the GRE message is judged to meet the preset condition, the central node can acquire the application type of the inner layer message in the GRE message and the tunnel source address for sending the GRE message.
Specifically, the central node decapsulates the GRE packet to obtain a tunnel source address of the GRE packet, where the tunnel source address is a tunnel interface address of a branch node that sends the GRE packet. And an inner layer message in the GRE message can be obtained, and the application type of the inner layer message can be determined according to the inner layer message.
After the application type of the inner layer message in the GRE message and the tunnel source address of the GRE message are obtained, a corresponding tunnel table entry is established according to the obtained application type and the tunnel source address, the aging time is set for the tunnel table entry, and the tunnel table entry is maintained in a second tunnel table.
And setting aging time for the tunnel table entry to indicate the aging duration of the tunnel table entry. Thus, each tunnel entry in the second tunnel table includes an application type, a tunnel source address, and an aging time.
Taking table 2 below as an example, table 2 is a tunnel table entry in the second tunnel table, and the corresponding relationship in the tunnel table entry is: OSPF is corresponding to 2.0.0.1, and the aging time of the tunnel table entry is 60 seconds.
TABLE 2
Figure GDA0002887679620000121
The aging time of the tunnel table entry may be timed from the establishment of the tunnel table entry, and when the aging time of one tunnel table entry becomes 0 second, the one tunnel table entry may be deleted from the second tunnel table.
For example, if the aging time of one tunnel entry in the second tunnel table is 60 seconds, the aging time is continuously decreased from 60 seconds when the tunnel entry is established, and the tunnel entry is deleted from the second tunnel table when the aging time becomes 0 second.
The aging time may be custom set. In one implementation, the aging time may be set according to a service type of the packet, and specifically, the set aging time is greater than a time interval between two consecutive transmissions of the packet belonging to the same service type. For example, for a message of a service type, the time interval between two consecutive transmissions of the message is 50 seconds, and the aging time for the service type should be greater than 50 seconds.
By setting the aging time for the tunnel table entries in the second tunnel table, each tunnel table entry is only maintained in the second tunnel table within the corresponding aging time, and once the aging time becomes 0, the tunnel table entry is deleted from the second tunnel table, thereby releasing a certain storage space. Thus, the storage space resource of the central node is saved.
In an embodiment, when the message to be sent is sent by using the second tunnel table entry, the aging time of the second tunnel table entry matching the target application type may also be reset to a preset default value.
Wherein the default value can be set by self. And after the aging time of the second tunnel table entry is reset to the default value, changing the aging time of the second tunnel table entry into the default value, and restarting timing. And after the aging time with the duration as the default value becomes 0 and the second tunnel table entry is not successfully matched in the process that the aging time becomes 0, deleting the corresponding relation.
Taking the above table 2 as an example, the default value is 60 seconds, the aging time in the above table 1 is continuously decreased, when the aging time is decreased to 10 seconds, and when the central node matches the target application type of OSPF, the central node successfully matches the tunnel table entry in the table 2, the aging time in the table 2 is reset to 60 seconds, and the aging time is counted from 60 seconds again.
An embodiment of the present application further provides a message sending method, as shown in fig. 2, where the message sending method includes the following steps.
S201, receiving GRE message sent by the branch node.
The description will be made by taking fig. 3 as an example. A is the central node, B is the branch node, and GRE tunnel is established between A and B. The IPv6 address configured by the A is 1111::1111, the tunnel address is 1.0.0.1, when the IPv6 address required to be configured by the B is 1111::1111, according to the requirement of an IPv6 protocol, before the configured IPv6 address takes effect, the NS message is sent to carry out repeated address detection, and the NS message carries the required detection address, namely 1111:: 1111. The tunnel address of B is 2.0.0.1, B utilizes the tunnel address to encapsulate NS message, namely NS message is inner layer message, obtains GRE message based on NS message, and sends GRE message to A.
For the GRE packet, as shown in table 3 below, the tunnel source address of the encapsulation layer IP header is 2.0.0.1, and the tunnel destination address is: 1.0.0.1, the source IP address of the inner layer IP header is ff02::1: ff00: 1111.
TABLE 3
Source addressDestination address
Encapsulation layer IP header2.0.0.11.0.0.1
Inner IP head::ff02::1:ff00:1111
S202, the destination address of the inner layer message in the received GRE message is obtained, and whether the obtained destination address is any one of the address of the central node, the multicast address matched with the address of the central node and the broadcast address is judged. If yes, the received GRE message is determined to meet the preset condition.
After the A receives the GRE message, decapsulating the GRE message to obtain that the destination address of the NS message is ff02: 1: ff00:1111, the destination address is a multicast address and is matched with the IPv6 address 1111: 1111 of the A, and then the GRE message can be determined to meet the preset condition.
In addition, after receiving the GRE packet, a may establish a first tunnel entry according to the GRE packet, as shown in table 4 below.
TABLE 4
Figure GDA0002887679620000141
Wherein the aging time of the established first tunnel table entry is 10 seconds, and the first tunnel table entry is maintained in the first tunnel table.
S203, obtaining the application type of the inner layer message in the GRE message and the tunnel source address for sending the GRE message.
After decapsulating the GRE message, the a may obtain an NS message, obtain protocol information from a message IP header of the NS message, and determine that the application type of the NS message is an IPv6DAD (Duplicate address detection) application type according to the protocol information and the ICMP message information. In addition, a can also obtain the tunnel source address from the GRE message as 2.0.0.1.
And S204, establishing a corresponding tunnel table entry according to the acquired application type and the tunnel source address, setting aging time for the tunnel table entry, and maintaining the tunnel table entry in a second tunnel table.
The established tunnel table entry comprises: IPv6DAD corresponds to 2.0.0.1, and aging time 10 seconds. The tunnel table entries established are shown in table 5 below.
TABLE 5
Figure GDA0002887679620000142
S205, the destination address of the message to be sent is used for inquiring the first tunnel table, and if the first tunnel table item matched with the destination address of the message to be sent does not exist, the target application type of the message to be sent is determined.
When the A performs repeated address detection processing on the NA message, and finds that the detected address is 1111:, the A can determine the address conflict with the A itself, and then the A needs to send the NA message to the B to report the address conflict to the B. When A sends NA message to B, it is sent in multicast mode, so for NA message, the source address is 1111::1111, and the destination address is ff02:: 1.
A queries whether a first tunnel table item matched with ff02::1 exists in a first tunnel table by using a destination address (ff02::1) of the NA message, if the first tunnel table item matched with ff02::1 is not queried, the target application type of the NA message can be determined, and whether a second tunnel table item matched with the target application type of the NA message exists is queried in a second tunnel table. If the application type of the NA message is determined to be IPv6DAD, and IPv6DAD is taken as the target application type.
S206, the second tunnel table is inquired by the target application type.
And A inquires whether a second tunnel table entry matching with the IPv6DAD exists in the second tunnel table, namely, whether a second tunnel table entry matching with the IPv6DAD exists in all tunnel table entries included in the second tunnel table.
And S207, if a second tunnel table item matched with the target application type exists, transmitting the message to be transmitted by using the second tunnel table item. And resetting the aging time of the second tunnel table entry matched with the target application type to a preset default value.
When only the tunnel table entry in the table 5 in the second tunnel table matches with the target application type IPv6DAD, the tunnel source address corresponding to the IPv6DAD is obtained from the tunnel table entry in the table 5 and is 2.0.0.1, and the address 2.0.0.1 is used as the tunnel destination address to encapsulate the NA packet, so as to obtain a GRE packet based on the NA packet. For the GRE packet based on the NA packet, as shown in table 6 below, the tunnel source address of the encapsulation layer IP header is 1.0.0.1, and the tunnel destination address is: 2.0.0.1, the source IP address of the inner layer IP header is 1111::1111, and the destination address is ff02:: 1.
TABLE 6
Source addressDestination address
Encapsulation layer IP header1.0.0.12.0.0.1
Inner IP head1111::1111ff02::1
And the A adopts the second tunnel table item to package the NA message to obtain a corresponding GRE message, and then sends the GRE message to the B through the corresponding GRE tunnel. Therefore, for the message to be sent, even if the tunnel destination address cannot be obtained from the first tunnel table, the tunnel destination address can be obtained from the second tunnel table by the technical scheme provided by the embodiment of the application, and then the message to be sent is encapsulated by using the tunnel destination address, and the GRE message obtained after encapsulation is sent to the branch node.
Corresponding to the foregoing message sending method embodiment, an embodiment of the present application further provides a message sending apparatus, which is applied to a central node, and as shown in fig. 4, the message sending apparatus includes:
afirst query module 410, configured to query a first tunnel table by using a destination address of a message to be sent;
a first determiningmodule 420, configured to determine a target application type of a message to be sent if there is no first tunnel entry matching a destination address of the message to be sent;
asecond query module 430, configured to query a second tunnel table by using the target application type, where the second tunnel table is established according to the application type of the inner layer packet in the GRE packet sent by the branch node and the tunnel source address for sending the GRE packet;
the sendingmodule 440 is configured to send a message to be sent by using a second tunnel table entry if the second tunnel table entry exists, where the second tunnel table entry matches the target application type.
In one embodiment, the message sending apparatus may further include:
the judging module is used for receiving the GRE message sent by the branch node and judging whether the GRE message meets a preset condition;
the obtaining module is used for obtaining the application type of the inner layer message in the GRE message and the tunnel source address for sending the GRE message when the judgment result of the judging module is yes;
and the establishing module is used for establishing a corresponding tunnel table entry according to the acquired application type and the tunnel source address, setting aging time for the tunnel table entry and maintaining the tunnel table entry in a second tunnel table.
In one embodiment, the message sending apparatus may further include:
and the resetting module is used for resetting the aging time of the second tunnel table entry matched with the target application type to a preset default value.
In one embodiment, the determining module is specifically configured to:
acquiring a destination address of an inner layer message in the received GRE message, and judging whether the acquired destination address is any one of the address of a central node, a multicast address matched with the address of the central node and a broadcast address; if yes, the received GRE message is determined to meet the preset condition.
In one embodiment, the sendingmodule 440 is specifically configured to:
if the number of the second tunnel table entries is multiple, GRE encapsulation is respectively carried out on the message to be sent by utilizing the tunnel address in each second tunnel table entry, so as to obtain each GRE message with different tunnel destination addresses; and respectively sending each GRE message obtained after encapsulation through a corresponding GRE tunnel.
According to the technical scheme provided by the embodiment of the application, the second tunnel table is established by the center node according to the application type of the inner layer message in the received GRE message sent by the branch node and the tunnel source address sending the GRE message, and when the center node receives the GRE message of the asymmetric IP service, the mapping relation between the application type of the asymmetric IP service message in the GRE message and the source address of the GRE tunnel sending the GRE message is recorded in the second tunnel table, namely the corresponding tunnel table entry is established. For the central node, for a response packet of a service packet, the application types of the response packet sent by the central node and the received service packet are the same, so that when the central node responds to the received service packet, a packet to be sent of an asymmetric IP service needs to be sent, based on the unchanged application type, a second tunnel table entry matched with the application type of the packet to be sent can be queried from the second tunnel table, and the packet to be sent is sent by using the second tunnel table entry.
An electronic device is also provided in the embodiments of the present application, as shown in fig. 5, and includes aprocessor 510 and a machine-readable storage medium 520, where the machine-readable storage medium 520 stores machine-executable instructions that can be executed by theprocessor 510.
In addition, as shown in fig. 5, the electronic device may further include: acommunication interface 530 and acommunication bus 540; theprocessor 510, the machine-readable storage medium 520, and thecommunication interface 530 are configured to communicate with each other via acommunication bus 540, and thecommunication interface 530 is configured to communicate with other devices.
Processor 510 causes execution of any of the embodiments of messaging methods described above, wherein the messaging methods include:
inquiring a first tunnel table by using a destination address of a message to be sent;
if the first tunnel table item matched with the destination address of the message to be sent does not exist, determining the target application type of the message to be sent;
querying a second tunnel table by using the target application type, wherein the second tunnel table is established according to the application type of an inner layer message in the GRE message sent by the branch node and a tunnel source address for sending the GRE message;
and if a second tunnel table item matched with the target application type exists, transmitting the message to be transmitted by using the second tunnel table item.
According to the technical scheme provided by the embodiment of the application, the second tunnel table is established by the center node according to the application type of the inner layer message in the received GRE message sent by the branch node and the tunnel source address sending the GRE message, and when the center node receives the GRE message of the asymmetric IP service, the mapping relation between the application type of the asymmetric IP service message in the GRE message and the source address of the GRE tunnel sending the GRE message is recorded in the second tunnel table, namely the corresponding tunnel table entry is established. For the central node, for a response packet of a service packet, the application types of the response packet sent by the central node and the received service packet are the same, so that when the central node responds to the received service packet, a packet to be sent of an asymmetric IP service needs to be sent, based on the unchanged application type, a second tunnel table entry matched with the application type of the packet to be sent can be queried from the second tunnel table, and the packet to be sent is sent by using the second tunnel table entry.
Thecommunication bus 540 may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. Thecommunication bus 540 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 5, but this is not intended to represent only one bus or type of bus.
The machine-readable storage medium 520 may include a RAM (Random Access Memory) and may also include a NVM (Non-Volatile Memory), such as at least one disk Memory. Additionally, the machine-readable storage medium 520 may also be at least one memory device located remotely from the aforementioned processor.
TheProcessor 510 may be a general-purpose Processor including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also DSPs (Digital Signal Processing), ASICs (Application Specific Integrated circuits), FPGAs (Field Programmable Gate arrays) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
Corresponding to the above embodiment of the message sending method, an embodiment of the present application further provides a machine-readable storage medium, storing machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the message sending method.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the message sending apparatus, the electronic device and the machine-readable storage medium, since they are basically similar to the embodiments of the message sending method, the description is relatively simple, and for the relevant points, refer to the partial description of the embodiments of the method.
The above description is only for the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (12)

1. A message sending method is characterized in that the message sending method is applied to a central node, and the method comprises the following steps:
inquiring a first tunnel table by using a destination address of a message to be sent;
if the first tunnel table item matched with the destination address of the message to be sent does not exist, determining the target application type of the message to be sent;
querying a second tunnel table by using the target application type, wherein the second tunnel table is established according to the application type of an inner layer message in a generic routing encapsulation GRE message sent by a branch node and a tunnel source address for sending the GRE message;
and if a second tunnel table item matched with the target application type exists, transmitting the message to be transmitted by using the second tunnel table item.
2. The method of claim 1, further comprising:
receiving a GRE message sent by a branch node, and judging whether the GRE message meets a preset condition;
if yes, acquiring the application type of an inner layer message in the GRE message and a tunnel source address for sending the GRE message;
and establishing a corresponding tunnel table entry according to the acquired application type and the tunnel source address, setting aging time for the tunnel table entry, and maintaining the aging time in a second tunnel table.
3. The method according to claim 2, wherein when the second tunnel table entry is used to transmit the message to be transmitted, the method further comprises:
and resetting the aging time of the second tunnel table entry matched with the target application type to a preset default value.
4. The method of claim 2 wherein said step of determining whether the GRE message satisfies a predetermined condition comprises:
acquiring a destination address of an inner layer message in the received GRE message;
judging whether the obtained destination address is any one of the address of the central node, a multicast address matched with the address of the central node and a broadcast address;
if yes, the received GRE message is determined to meet the preset condition.
5. The method according to claim 1, wherein the step of sending the message to be sent by using the second tunnel table entry comprises:
if the number of the second tunnel table entries is multiple, GRE encapsulation is respectively carried out on the message to be sent by using the tunnel address in each second tunnel table entry, so as to obtain each GRE message with different tunnel destination addresses;
and respectively sending each GRE message obtained after encapsulation through a corresponding GRE tunnel.
6. A message sending apparatus, applied to a central node, the apparatus comprising:
the first query module is used for querying a first tunnel table by using a destination address of a message to be sent;
the first determining module is used for determining the target application type of the message to be sent if a first tunnel table item matched with the destination address of the message to be sent does not exist;
the second query module is used for querying a second tunnel table by using the target application type, wherein the second tunnel table is established according to the application type of an inner layer message in the GRE message sent by the branch node and a tunnel source address for sending the GRE message;
and the sending module is used for sending the message to be sent by utilizing a second tunnel table item if the second tunnel table item matched with the target application type exists.
7. The apparatus of claim 6, further comprising:
the judging module is used for receiving the GRE message sent by the branch node and judging whether the GRE message meets a preset condition;
the obtaining module is used for obtaining the application type of the inner layer message in the GRE message and the tunnel source address for sending the GRE message when the judgment result of the judging module is yes;
and the establishing module is used for establishing a corresponding tunnel table entry according to the acquired application type and the tunnel source address, setting aging time for the tunnel table entry and maintaining the tunnel table entry in a second tunnel table.
8. The apparatus of claim 7, further comprising:
and the resetting module is used for resetting the aging time of the second tunnel table entry matched with the target application type to a preset default value.
9. The apparatus of claim 7, wherein the determining module is specifically configured to:
acquiring a destination address of an inner layer message in the received GRE message, and judging whether the acquired destination address is any one of the address of the central node, a multicast address matched with the address of the central node and a broadcast address; if yes, the received GRE message is determined to meet the preset condition.
10. The apparatus of claim 6, wherein the sending module is specifically configured to:
if the number of the second tunnel table entries is multiple, GRE encapsulation is respectively carried out on the message to be sent by using the tunnel address in each second tunnel table entry, so as to obtain each GRE message with different tunnel destination addresses; and respectively sending each GRE message obtained after encapsulation through a corresponding GRE tunnel.
11. An electronic device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: carrying out the method steps of any one of claims 1 to 5.
12. A machine-readable storage medium having stored thereon machine-executable instructions that, when invoked and executed by a processor, cause the processor to: carrying out the method steps of any one of claims 1 to 5.
CN201811273708.9A2018-10-302018-10-30Message sending method and deviceActiveCN109039918B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201811273708.9ACN109039918B (en)2018-10-302018-10-30Message sending method and device

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201811273708.9ACN109039918B (en)2018-10-302018-10-30Message sending method and device

Publications (2)

Publication NumberPublication Date
CN109039918A CN109039918A (en)2018-12-18
CN109039918Btrue CN109039918B (en)2021-05-28

Family

ID=64614465

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201811273708.9AActiveCN109039918B (en)2018-10-302018-10-30Message sending method and device

Country Status (1)

CountryLink
CN (1)CN109039918B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN109743256B (en)*2019-03-222022-01-14成都西加云杉科技有限公司Message forwarding method and device
CN111211981A (en)*2019-12-302020-05-29杭州迪普科技股份有限公司Message forwarding method and device based on policy routing
CN114697408B (en)*2020-12-282023-09-26国家计算机网络与信息安全管理中心Tunnel message processing method and device
CN113794643A (en)*2021-08-312021-12-14新华三信息安全技术有限公司Flow forwarding method and node equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101848171A (en)*2010-07-012010-09-29杭州华三通信技术有限公司Data transmission method based on GRE tunnel, device and system
CN102130826A (en)*2010-11-252011-07-20华为技术有限公司 Message sending method and device
CN106878184A (en)*2017-02-282017-06-20新华三技术有限公司A kind of data message transmission method and device
WO2018109536A1 (en)*2016-12-172018-06-21Telefonaktiebolaget Lm Ericsson (Publ)Method and apparatus for monitoring virtual extensible local area network (vxlan) tunnel with border gateway protocol (bgp)-ethernet virtual private network (evpn) infrastructure

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101848171A (en)*2010-07-012010-09-29杭州华三通信技术有限公司Data transmission method based on GRE tunnel, device and system
CN102130826A (en)*2010-11-252011-07-20华为技术有限公司 Message sending method and device
WO2018109536A1 (en)*2016-12-172018-06-21Telefonaktiebolaget Lm Ericsson (Publ)Method and apparatus for monitoring virtual extensible local area network (vxlan) tunnel with border gateway protocol (bgp)-ethernet virtual private network (evpn) infrastructure
CN106878184A (en)*2017-02-282017-06-20新华三技术有限公司A kind of data message transmission method and device

Also Published As

Publication numberPublication date
CN109039918A (en)2018-12-18

Similar Documents

PublicationPublication DateTitle
CN109039918B (en)Message sending method and device
US8589582B2 (en)Broadband network access
KR100453055B1 (en)Method for path MTU discovery on IP network and apparatus thereof
CN112491718B (en) Message header processing method and device, storage medium, and electronic device
CN107342939B (en)Method and device for transmitting data
EP3605974B1 (en)Information transfer methods and devices
CN110636001A (en) Method and network node for sending network performance parameters, calculating network performance
CN108965204B (en)Method and device for automatically realizing IOAM packaging
EP3657742B1 (en)Method and apparatus for processing modified packet
CN107580079B (en)Message transmission method and device
CN112737954B (en)Message processing method, device, system, equipment and storage medium
CN112491706B (en)Data message processing method and device, storage medium and electronic device
CN102273177A (en) Neighbor Discovery Protocol Mediation
CN104579966B (en)Method, forward node and the controller that forwarding-table item generates
CN104683210A (en)Automatic tunnel establishing method and device
CN107231269B (en)Accurate cluster speed limiting method and device
CN106254265A (en)Process the methods, devices and systems of message
CN109981819B (en)mDNS message processing method, device and networking system
CN109120741B (en)Duplicate address detection method and device and computer readable storage medium
CN108075991B (en)Message forwarding method and device
CN111371909B (en)Method and system for realizing 4in6DS Lite data stream forwarding
CN108259301B (en)Tunnel online method and device
CN115987866B (en) Method, device and storage medium for processing notification information
CN115695306B (en) A message transmission system, method, device, equipment and medium
CN111600798B (en)Method and equipment for sending and obtaining assertion message

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp