CN112615781B - Method and server for realizing BGP message interaction in DPDK - Google Patents

Method and server for realizing BGP message interaction in DPDK Download PDF

Info

Publication number
CN112615781B
CN112615781B CN202011425907.4A CN202011425907A CN112615781B CN 112615781 B CN112615781 B CN 112615781B CN 202011425907 A CN202011425907 A CN 202011425907A CN 112615781 B CN112615781 B CN 112615781B
Authority
CN
China
Prior art keywords
network card
virtual network
quintuple information
address
port
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
CN202011425907.4A
Other languages
Chinese (zh)
Other versions
CN112615781A (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.)
Wangsu Science and Technology Co Ltd
Original Assignee
Wangsu Science and Technology 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 Wangsu Science and Technology Co Ltd filed Critical Wangsu Science and Technology Co Ltd
Priority to CN202011425907.4A priority Critical patent/CN112615781B/en
Publication of CN112615781A publication Critical patent/CN112615781A/en
Application granted granted Critical
Publication of CN112615781B publication Critical patent/CN112615781B/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/02Topology update or discovery
    • H04L45/04Interdomain routing, e.g. hierarchical routing
    • 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

Abstract

The invention discloses a method and a server for realizing BGP message interaction in DPDK, wherein the method comprises the following steps: configuring a first virtual network card, a second virtual network card and a third virtual network card; after receiving a data packet sent by the FRR program in the form of first quintuple information, the DPDK replaces the first quintuple information in the data packet with second quintuple information and sends the data packet with the second quintuple information to the BGP peer; and after receiving a reply data packet fed back by the BGP peer in the form of the third quintuple information, the DPDK replaces the third quintuple information in the reply data packet with the fourth quintuple information and sends the reply data packet replacing the quintuple information to the FRR program to establish communication connection between the FRR program and the BGP peer. According to the technical scheme provided by the application, the FRR program can be in communication connection with the BGP peer under the DPDK framework.

Description

Method and server for realizing BGP message interaction in DPDK
Technical Field
The invention relates to the technical field of internet, in particular to a method and a server for realizing BGP message interaction in DPDK.
Background
The DPDK (Data Plane Development Kit, data Plane Development toolset) can bypass the kernel-mode Data path, and optimize the user-mode Data path through vector instructions, large-page memories, core binding and other technologies, so as to improve the message processing speed of the physical network card and the virtual machine network card. BGP (Border Gateway Protocol) belongs to an exterior Gateway routing Protocol, can exchange network reachability information between autonomous systems, and is often used for a Border router of an autonomous system. FRR (Free Range Routing) is border router software of a Linux platform, and since FRR receives and transmits BGP messages through a Linux kernel and DPDK directly receives and transmits network messages from a network card by bypassing the kernel, DPDK cannot directly use BGP components of FRR for BGP message interaction.
Disclosure of Invention
The application aims to provide a method and a server for realizing BGP message interaction in a DPDK, so that a FRR program can establish communication connection with a BGP peer under a DPDK frame.
In order to achieve the above object, an aspect of the present application provides a method for implementing BGP message interaction in DPDK, where the method includes: configuring a first virtual network card, a second virtual network card and a third virtual network card, generating first quintuple information and fourth quintuple information based on configuration information of the first virtual network card and the second virtual network card, and generating second quintuple information and third quintuple information according to configuration information of the third virtual network card and configuration information of a BGP peer; after receiving a data packet sent by the FRR program in the first quintuple information, the DPDK replaces the first quintuple information in the data packet with the second quintuple information and sends the data packet with the quintuple information replaced to the BGP peer; and after receiving a reply data packet fed back by the BGP peer in the third quintuple information, the DPDK replaces the third quintuple information in the reply data packet with the fourth quintuple information and sends the reply data packet replacing the quintuple information to the FRR program to establish communication connection between the FRR program and the BGP peer.
In order to achieve the above object, another aspect of the present application further provides a method for implementing BGP message interaction in DPDK, where the method includes: configuring a first virtual network card, a second virtual network card and a third virtual network card, generating first quintuple information and fourth quintuple information according to configuration information of the third virtual network card and configuration information of a BGP peer, and generating second quintuple information and third quintuple information based on the configuration information of the first virtual network card and the second virtual network card; after receiving a data packet sent by the BGP peer in the first quintuple information, the DPDK replaces the first quintuple information in the data packet with the second quintuple information and sends the data packet with the quintuple information replaced to the FRR program; the destination port in the second quintuple information is a BGP port of a kernel network card interface; and after receiving a reply data packet fed back by the FRR program according to the third quintuple information, the DPDK replaces the third quintuple information in the reply data packet with the fourth quintuple information and sends the reply data packet replacing the quintuple information to the BGP peer so as to establish communication connection between the FRR program and the BGP peer.
To achieve the above object, another aspect of the present application further provides a server, which includes a memory and a processor, where the memory is used to store a computer program, and the computer program implements the above method when executed by the processor.
As can be seen from the above, the technical solutions provided by one or more embodiments of the present application may be compatible with two modes, namely, an active connection mode and a passive connection mode under a BGP protocol. In the active mode, the FRR program sends a data packet for establishing a connection to the DPDK with first quintuple information, which is generated based on configuration information of the first virtual network card and the second virtual network card. After the DPDK receives the data packet, in order to send the data packet to the BGP peer, the first quintuple information needs to be replaced with second quintuple information, where the second quintuple information is generated based on the configuration information of the third virtual network card and the BGP peer. Thus, after the quintuple information is replaced, the data packet can be normally sent to the BGP peer by the DPDK. Subsequently, after receiving the reply packet sent by the BGP peer, the quintuple information in the reply packet also needs to be replaced, and finally the reply packet may be received by the FRR program, thereby completing the establishment process of the communication connection.
In passive mode, the FRR program may listen for connection requests from the BGP peer. At this time, the BGP peer may send a packet for establishing a connection to the DPDK, and the packet may be subjected to a process of replacing the quintuple information by the DPDK. Similarly, after receiving the data packet, the FRR program may feed back a reply data packet to the DPDK, where the reply data packet may be sent from the DPDK to the BGP peer after being replaced by the quintuple information, thereby completing the establishment process of the communication connection.
It can be seen that, no matter in the active mode or the passive mode, the DPDK can perform the process of identifying and replacing the five tuple information between the FRR program and the BGP peer. Thus, under the DPDK framework, the FRR program can establish communication connection with the BGP peer, and the interaction of BGP messages can be realized between the FRR program and the BGP peer.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram illustrating steps of a BGP message interaction method in an active mode according to an embodiment of the present invention;
fig. 2 is a schematic diagram of BGP message interaction in an active mode according to an embodiment of the present invention;
fig. 3 is a schematic diagram illustrating steps of a BGP message interaction method in a passive mode according to an embodiment of the present invention;
fig. 4 is a schematic diagram of BGP message interaction in the passive mode in the embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clear, the technical solutions of the present application will be clearly and completely described below with reference to the detailed description of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art without any inventive work based on the embodiments in the present application are within the scope of protection of the present application.
The present application provides a method for implementing BGP message interaction in DPDK, which may be applied to the system architectures shown in fig. 2 and fig. 4. In this system, the FRR program may establish a communication connection with a BGP peer (peer) through the DPDK.
Referring to fig. 1, a method for implementing BGP message interaction in DPDK according to an embodiment of the present application may include the following multiple steps.
S11: configuring a first virtual network card, a second virtual network card and a third virtual network card, generating first quintuple information and fourth quintuple information based on configuration information of the first virtual network card and the second virtual network card, and generating second quintuple information and third quintuple information according to configuration information of the third virtual network card and configuration information of a BGP peer.
In this embodiment, the DPDK may create a first virtual network card intf1, a second virtual network card intf2, and a third virtual network card intf3 in advance, and may also create a KNI (Kernel NIC Interface) network card. The first, second and third virtual network cards are virtual network cards only with DPDK visible, and these three virtual network cards are not visible to the FRR program. And the KNI network card is a virtual network card visible to the FRR program. After the network cards are created, the first virtual network card intf1 can be bound with the KNI network card. After the first virtual network card intf1, the second virtual network card intf2 and the third virtual network card intf3 are created, respective IP addresses can be set for the three virtual network cards respectively. The IP address of the inch 1 can be configured as KNI _ IP, and represents the IP address of the KNI network card; the IP address of the inct 2 can be configured as a DPDK _ IP, and represents the IP address of the DPDK; the IP address of the inct 3 can be configured as BGP _ IP, and represents the IP address of BGP. The KNI _ IP and the DPDK _ IP can be in the same direct connection network segment.
In this embodiment, after the first virtual network card intf1, the second virtual network card intf2 and the third virtual network card intf3 are created, and the binding and the setting of the IP address are completed, the corresponding data may be used as the configuration information of these virtual network cards. Thus, the configuration information may at least include the binding relationship of the virtual network cards and the IP addresses corresponding to the virtual network cards.
In this embodiment, in order to enable the subsequent data packet to be normally transmitted in the network, a plurality of sets of quintuple information may be generated in advance. The FRR program needs to perform data interaction with a DPDK, and the DPDK needs to perform data interaction with a BGP peer. In this way, the first quintuple information may be generated based on the configuration information of the first virtual network card and the second virtual network card. In the first quintuple information, the supported protocol is a TCP protocol, the source IP address and the source PORT are the IP address of KNI and the PORT of KNI, respectively, the destination IP address and the destination PORT are the IP address of DPDK and the PORT of DPDK, respectively, and the expression may be A1 (TCP, KNI _ IP, KNI _ PORT, DPDK _ IP, DPDK _ PORT). The KNI _ PORT is equal to the DPDK _ PORT, so that the process of re-searching the PORT mapping can be avoided. In practical applications, the KNI _ PORT may be generated by the FRR program in a PORT pool. In the PORT pool of FRR, there may be a preset range of PORT numbers (e.g., 50000 to 60000), and then the FRR program may start from the first PORT number, determine whether the current PORT number is used, and if not, directly set the current PORT number as KNI _ PORT; if the port number is used, the next port number can be continuously judged until the port number which is not used is found.
In order to realize the interaction of BGP messages, a source IP address and a source port in a packet received by a BGP peer need to be IP addresses and ports related to BGP. Thus, the second quintuple information can be generated according to the configuration information of the third virtual network card intf3 and the configuration information of the BGP peer. In the second quintuple information, the source IP address and the source PORT are an IP address of BGP and a PORT of BGP, respectively, and the destination IP address and the destination PORT are an IP address of BGP PEER and a PORT of BGP PEER, respectively, and may be represented in a form of A2 (TCP, BGP _ IP, BGP _ PORT, PEER _ IP, PEER _ PORT). The BGP _ PORT may also be equal to the KNI _ PORT, so as to avoid the process of re-searching the PORT mapping. The PEER _ IP and the PEER _ PORT may be an IP address of the GBP PEER and a PORT used by the BGP PEER to listen to the BGP connection.
S13: and after receiving the data packet sent by the FRR program in the first quintuple information, the DPDK replaces the first quintuple information in the data packet with the second quintuple information and sends the data packet with the quintuple information replaced to the BGP peer.
In this embodiment, after the first quintuple information A1 and the second quintuple information A2 are generated, the FRR program may notify the DPDK through an Inter-Process Communication (IPC) mechanism that the quintuple information corresponding to A1 is A2, thereby establishing the mapping relationship between A1 and A2. Referring to fig. 2, the frr program may create a TCP connection with the KNI network card to send and receive data packets to and from the KNI network card.
In one embodiment, if the KNI network card does not have the MAC Address corresponding to the DPDK _ IP, an ARP (Address Resolution Protocol) broadcast packet is sent to search for the MAC Address corresponding to the DPDK _ IP. After the DPDK receives the broadcast packet sent by the KNI, the DPDK may feed back the MAC address of intf2 to the KNI for the broadcast packet, so that the KNI uses the MAC address of intf2 as the destination MAC address in the packet.
Subsequently, after receiving the data packet sent by the FRR program from the KNI, the DPDK may determine whether quintuple information in the data packet is A1, and if so, may replace A1 with A2, and replace the source MAC address and the destination MAC address in the data packet with the MAC address of intf3 and the MAC address of the BGP peer, respectively, and send the modified data packet to the BGP peer through intf 3.
S15: and after receiving a reply data packet fed back by the BGP peer in the third quintuple information, the DPDK replaces the third quintuple information in the reply data packet with the fourth quintuple information and sends the reply data packet replacing the quintuple information to the FRR program to establish communication connection between the FRR program and the BGP peer.
In this embodiment, after receiving a data packet sent from the DPDK, the BGP peer may feed back a reply data packet for the data packet. The BGP peer sends the reply packet with the third quintuple information A3. Since the reply packet is sent from the BGP peer to the DPDK, the third quintuple information may be generated based on the configuration information of the BGP peer and the configuration information of intf 2. In A3, the source IP address and the source PORT are an IP address of a BGP PEER and a PORT of the BGP PEER, respectively, and the destination IP address and the destination PORT are an IP address of BGP and a PORT of BGP, respectively, and may be represented in a form of A3 (TCP, PEER _ IP, PEER _ PORT, BGP _ IP, BGP _ PORT). In addition, when the DPDK needs to forward the reply packet to the FRR procedure, fourth quintuple information may be generated, which is related to the DPDK and the FRR procedure, and thus may be generated based on the configuration information of intf1 and intf 2. In the fourth quintuple information, the source IP address and the source PORT are the IP address of the DPDK and the PORT of the DPDK, respectively, and the destination IP address and the destination PORT are the IP address of the KNI and the PORT of the KNI, respectively, and are represented by A4 (TCP, DPDK _ IP, DPDK _ PORT, KNI _ IP, KNI _ PORT).
After receiving a reply data packet sent by the BGP peer from intf3, the DPDK can judge whether the quintuple is A3, if so, A4 can be used for replacing A3, the source MAC address and the destination MAC address are respectively replaced by the MAC address of intf2 and the MAC address of intf1, and the data packet with the modified MAC address is sent to the FRR program from intf 2.
The FRR program receives the reply data packet from the KNI network card, so that the communication connection between the FRR program and the BGP peer is established, and the subsequent BGP message interaction can be carried out on the established connection. If the connection is disconnected by FRR or some party of BGP peer, FRR may notify DPDK through IPC mechanism to release the corresponding five-tuple mapping.
An embodiment of the present application further provides a system for implementing BGP packet interaction in DPDK, where the system includes:
a configuration unit, configured to configure a first virtual network card, a second virtual network card, and a third virtual network card, generate first quintuple information and fourth quintuple information corresponding to an FRR program based on configuration information of the first virtual network card and the second virtual network card, and generate second quintuple information and third quintuple information corresponding to a DPDK according to configuration information of the third virtual network card and configuration information of a BGP peer;
a request unit, configured to replace, after receiving a data packet sent by the FRR program in the first quintuple information, the first quintuple information in the data packet with the second quintuple information, and send the data packet with the quintuple information replaced to the BGP peer;
and a reply unit, configured to replace the third quintuple information in the reply packet with the fourth quintuple information after receiving the reply packet fed back by the BGP peer with the third quintuple information, and send the reply packet replacing the quintuple information to the FRR program, so as to establish a communication connection between the FRR program and the BGP peer.
In another embodiment of the present application, a method for implementing BGP message interaction in DPDK may also be provided for a passive connection mode in a BGP protocol. Referring to fig. 3, the method may include the following steps.
S21: configuring a first virtual network card, a second virtual network card and a third virtual network card, generating first quintuple information and fourth quintuple information according to configuration information of the third virtual network card and configuration information of a BGP peer, and generating second quintuple information and third quintuple information based on the configuration information of the first virtual network card and the second virtual network card.
S23: after receiving a data packet sent by the BGP peer in the first quintuple information, the DPDK replaces the first quintuple information in the data packet with the second quintuple information and sends the data packet with the quintuple information replaced to the FRR program; and the destination port in the second quintuple information is a BGP port of a kernel network card interface.
S25: and after receiving a reply data packet fed back by the FRR program according to the third quintuple information, the DPDK replaces the third quintuple information in the reply data packet with the fourth quintuple information and sends the reply data packet replacing the quintuple information to the BGP peer so as to establish communication connection between the FRR program and the BGP peer.
In this embodiment, the first virtual network card intf1, the second virtual network card intf2, and the third virtual network card intf3 may be created in advance in the above manner, and the KNI network card may be created at the same time. The first, second and third virtual network cards are virtual network cards only visible by DPDK, and these three virtual network cards are invisible to the FRR program. And the KNI network card is a virtual network card visible to the FRR program. After the network cards are created, the first virtual network card intf1 can be bound with the KNI network card. After the first virtual network card intf1, the second virtual network card intf2 and the third virtual network card intf3 are created, respective IP addresses can be set for the three virtual network cards respectively. The IP address of the infet 1 can be configured to be KNI _ IP, and represents the IP address of the KNI network card; the IP address of the inch 2 can be configured as a DPDK _ IP to represent the IP address of the DPDK; the IP address of the inct 3 can be configured as BGP _ IP, and represents the IP address of BGP. The KNI _ IP and the DPDK _ IP can be in the same direct connection network segment.
Referring to fig. 4, the frr program may listen to a BGP PORT (KNI _ IP: BIND _ PORT 1) of the KNI network card, which may be denoted as BIND _ PORT1, and wait for a connection request initiated by the BGP peer. The BGP PEER may send a packet for establishing a connection to the DPDK through the first quintuple information P1 (TCP, PEER _ IP, PEER _ PORT, BGP _ IP, BIND _ PORT 2), where the PEER _ PORT represents a PORT of the BGP PEER, which may be randomly generated, and the PEER _ IP is an IP address of the BGP PEER. BGP _ IP is the IP address of the third virtual network card intf3, and BIND _ PORT2 may be a PORT to be identified. As can be seen, in the first quintuple information, the source IP address and the source port are the IP address of the BGP peer and the port of the BGP peer, respectively, and the destination IP address and the destination port are the IP address of the third virtual network card and the port to be identified, respectively. The first quintuple information can be generated according to the configuration information of the third virtual network card and the configuration information of the BGP peer. In addition, the DPDK can also announce the MAC addresses of intf3 and BGP peers to the BGP peer, so that the BGP peer can use the MAC address of the BGP peer and the MAC address of intf3 as the source MAC address and the destination MAC address, respectively, when sending the packet.
In this embodiment, after receiving the data packet of the BGP peer from the intf3 network card, the DPDK may determine whether the PORT to be identified is a BGP PORT of KNI, that is, determine whether BIND _ PORT2 in P1 is equal to BIND _ PORT1, and if so, indicate that the data packet is a data packet that the FRR program needs to monitor. At this time, the DPDK may further determine whether the packet has the corresponding cached quintuple information, and if not, it indicates that the packet is a packet corresponding to a new connection, and the packet should be sent to the FRR program to establish a communication connection between the FRR program and the BGP peer. Specifically, a second quintuple P2 (TCP, DPDK _ IP, DPDK _ PORT, KNI _ IP, BIND _ PORT 1) may be generated, and 1 in the packet may be replaced with P2. And respectively replacing the source MAC address and the destination MAC address with the MAC addresses of intf2 and intf1, and sending the modified data packet out of intf 2.
As can be seen, the second quintuple information is generated based on the configuration information of the first virtual network card and the second virtual network card, in the second quintuple information, the source IP address and the source PORT are the IP address of the DPDK and the PORT of the DPDK, respectively, the destination IP address is the IP address of KNI, and the destination PORT needs to be the BGP PORT BIND _ PORT1 of KNI.
In this embodiment, the FRR program receives the data packet through KNI, and then the FRR program may query the DPDK for the PEER _ IP corresponding to P2 (the PEER _ IP is provided by P1) through an IPC mechanism, and after confirming that the PEER _ IP is the IP address of the BGP PEER, the FRR program may feed back a reply message to the DPDK. The reply message is sent from the KNI network card by the third quintuple information P3 (TCP, KNI _ IP, BIND _ PORT1, DPDK _ IP, DPDK _ PORT). As can be seen, the third quintuple information is generated based on the configuration information of the first virtual network card and the second virtual network card.
After receiving the reply message of the FRR program from the intf1 network card, the DPDK can judge whether the quintuple information in the reply message is P3, if so, the DPDK can be replaced by fourth quintuple information P4 (TCP, BGP _ IP, BIND _ PORT1, PEER _ IP and PEER _ PORT), and respectively replace the source MAC address and the destination MAC address with the MAC addresses of the intf3 and the BGP PEER, and send the reply message to the PEER from the intf3 network card. Thus, the connection between the FRR program and the BGP peer is established, and the subsequent BGP message interaction can be carried out on the established connection. Similarly, if the connection is broken by either FRR or BGP peer, FRR informs DPDK through IPC to release the corresponding five-tuple mapping.
The present application further provides a system for implementing BGP message interaction in DPDK, where the system includes:
a configuration unit, configured to configure a first virtual network card, a second virtual network card, and a third virtual network card, generate first quintuple information and fourth quintuple information according to configuration information of the third virtual network card and configuration information of a BGP peer, and generate second quintuple information and third quintuple information based on the configuration information of the first virtual network card and the second virtual network card;
the request unit is used for replacing the first quintuple information in the data packet with the second quintuple information after receiving the data packet sent by the BGP peer in the first quintuple information, and sending the data packet with the quintuple information replaced to the FRR program; the destination port in the second quintuple information is a BGP port of a kernel network card interface;
and the reply unit is used for replacing the third quintuple information in the reply data packet with the fourth quintuple information after receiving a reply data packet fed back by the FRR program according to the third quintuple information, and sending the reply data packet replacing the quintuple information to the BGP peer so as to establish communication connection between the FRR program and the BGP peer.
The present application also provides a server comprising a memory for storing a computer program and a processor, the computer program, when executed by the processor, is for implementing the method as described above.
As can be seen from the above, the technical solutions provided by one or more embodiments of the present application may be compatible with two modes, namely, an active connection mode and a passive connection mode under a BGP protocol. In the active mode, the FRR program sends a data packet for establishing a connection to the DPDK with first quintuple information, which is generated based on configuration information of the first virtual network card and the second virtual network card. After the DPDK receives the data packet, in order to send the data packet to the BGP peer, the first quintuple information needs to be replaced with second quintuple information, where the second quintuple information is generated based on the configuration information of the third virtual network card and the BGP peer. Thus, after the quintuple information is replaced, the data packet can be normally sent to the BGP peer by the DPDK. Subsequently, after receiving the reply packet sent by the BGP peer, the quintuple information in the reply packet also needs to be replaced, and finally the reply packet may be received by the FRR program, thereby completing the establishment process of the communication connection.
In passive mode, the FRR program may listen for connection requests from BGP peers. At this time, the BGP peer may send a packet for establishing a connection to the DPDK, and the packet may be subjected to a process of replacing the five-tuple information by the DPDK. Similarly, after receiving the data packet, the FRR program may feed back a reply data packet to the DPDK, where the reply data packet may be sent from the DPDK to the BGP peer after being replaced by the quintuple information, thereby completing the establishment process of the communication connection.
It can be seen that, no matter in the active mode or the passive mode, the DPDK can perform the process of identifying and replacing the five tuple information between the FRR program and the BGP peer. Thus, under the DPDK framework, the FRR program can establish communication connection with the BGP peer, and the interaction of BGP messages can be realized between the FRR program and the BGP peer.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, both the system and the server embodiments can be explained with reference to the introduction of the embodiments of the method described above.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that 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 phrases "comprising a," "...," or "comprising" does not exclude the presence of other like elements in a process, method, article, or apparatus comprising the element.
The above description is only an embodiment of the present application, and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (18)

1. A method for implementing BGP message interaction in DPDK is characterized in that the method comprises:
configuring a first virtual network card, a second virtual network card and a third virtual network card, generating first quintuple information and fourth quintuple information based on configuration information of the first virtual network card and the second virtual network card, and generating second quintuple information and third quintuple information according to configuration information of the third virtual network card and configuration information of a BGP peer;
after receiving a data packet sent by the FRR program in the first quintuple information, the DPDK replaces the first quintuple information in the data packet with the second quintuple information and sends the data packet with the quintuple information replaced to the BGP peer;
after receiving a reply data packet fed back by the BGP peer in the third quintuple information, the DPDK replaces the third quintuple information in the reply data packet with the fourth quintuple information and sends the reply data packet replacing the quintuple information to the FRR program to establish communication connection between the FRR program and the BGP peer;
configuring the first virtual network card, the second virtual network card, and the third virtual network card includes:
creating a first virtual network card, a second virtual network card and a third virtual network card;
and setting respective IP addresses for the first virtual network card, the second virtual network card and the third virtual network card respectively.
2. The method of claim 1, wherein configuring the first virtual network card, the second virtual network card, and the third virtual network card further comprises:
binding the first virtual network card with a kernel network card interface;
and the IP addresses of the first virtual network card and the second virtual network card are in the same direct connection network segment.
3. The method of claim 1, wherein the IP address of the first virtual network card represents an IP address of a kernel network card interface, the IP address of the second virtual network card represents an IP address of a DPDK, and the IP address of the third virtual network card represents an IP address of a BGP.
4. The method according to claim 1 or 3, wherein in the first quintuple information, a source IP address and a source port are an IP address of a kernel network card interface and a port of the kernel network card interface, respectively, and a destination IP address and a destination port are an IP address of a DPDK and a port of the DPDK, respectively, wherein the port of the kernel network card interface is equal to the port number of the DPDK.
5. The method according to claim 1 or 3, wherein in the second quintuple information, the source IP address and the source port are respectively an IP address of BGP and a port of BGP, and the destination IP address and the destination port are respectively an IP address of BGP peer and a port of BGP peer, wherein the port of BGP is equal to a port number of the kernel network card interface.
6. The method of claim 1, wherein before receiving the packet sent by the FRR procedure with the first quintuple, the DPDK further comprises:
if the kernel network card interface does not have the MAC address corresponding to the IP address of the DPDK, the DPDK receives a broadcast data packet sent by the kernel network card interface and feeds back the MAC address of the second virtual network card to the kernel network card interface aiming at the broadcast data packet, so that the kernel network card interface takes the MAC address of the second virtual network card as the destination MAC address in the data packet.
7. The method according to claim 1 or 6, wherein after replacing the first quintuple information in the packet with the second quintuple information, the method further comprises:
and replacing the source MAC address and the destination MAC address in the data packet with the MAC address of the third virtual network card and the MAC address of the BGP peer respectively, and sending the data packet with the modified MAC address out of the third virtual network card.
8. The method according to claim 1, wherein in the third quintuple information, the source IP address and the source port are an IP address of a BGP peer and a port of the BGP peer, respectively, and the destination IP address and the destination port are an IP address of a BGP peer and a port of a BGP, respectively; in the fourth quintuple information, the source IP address and the source port are an IP address of a DPDK and a port of the DPDK, respectively, and the destination IP address and the destination port are an IP address of a kernel network card interface and a port of the kernel network card interface, respectively.
9. The method of claim 1, wherein after replacing the third quintuple information in the reply packet with the fourth quintuple information, the method further comprises:
and replacing the source MAC address and the destination MAC address in the reply data packet with the MAC address of the second virtual network card and the MAC address of the first virtual network card respectively, and sending the data packet with the modified MAC addresses out of the second virtual network card.
10. A server, characterized in that the server comprises a memory for storing a computer program for implementing the method of any of claims 1 to 9 when the computer program is executed by a processor and a processor.
11. A method for implementing BGP message interaction in DPDK is characterized in that the method comprises:
configuring a first virtual network card, a second virtual network card and a third virtual network card, generating first quintuple information and fourth quintuple information according to configuration information of the third virtual network card and configuration information of a BGP peer, and generating second quintuple information and third quintuple information based on the configuration information of the first virtual network card and the second virtual network card;
after receiving a data packet sent by the BGP peer in the first quintuple information, the DPDK replaces the first quintuple information in the data packet with the second quintuple information and sends the data packet with the quintuple information replaced to the FRR program; the destination port in the second quintuple information is a BGP port of a kernel network card interface;
after receiving a reply data packet fed back by the FRR program by the third quintuple information, the DPDK replaces the third quintuple information in the reply data packet with the fourth quintuple information, and sends the reply data packet replacing the quintuple information to the BGP peer, so as to establish communication connection between the FRR program and the BGP peer;
configuring the first virtual network card, the second virtual network card and the third virtual network card comprises:
creating a first virtual network card, a second virtual network card and a third virtual network card;
and setting respective IP addresses for the first virtual network card, the second virtual network card and the third virtual network card respectively.
12. The method of claim 11, wherein configuring the first virtual network card, the second virtual network card, and the third virtual network card further comprises:
binding the first virtual network card with a kernel network card interface;
and the IP addresses of the first virtual network card and the second virtual network card are in the same direct connection network segment.
13. The method of claim 11, wherein the FRR program listens to a BGP port of a kernel network card interface for a connection initiated by the BGP peer.
14. The method according to claim 11, wherein in the first quintuple information, a source IP address and a source port are an IP address of a BGP peer and a port of the BGP peer, respectively, and a destination IP address and a destination port are an IP address of the third virtual network card and a port to be identified, respectively;
and after receiving a data packet sent by a BGP peer in the first quintuple information through the third virtual network card, the DPDK judges whether the port to be identified is a BGP port of a kernel network card interface, judges whether the data packet has corresponding cached quintuple information if the port to be identified is the BGP port of the kernel network card interface, and replaces the first quintuple information in the data packet with the generated second quintuple information if the port to be identified is not the BGP port of the kernel network card interface.
15. The method according to claim 11, wherein in the second quintuple information, the source IP address and the source port are an IP address of a DPDK and a port of the DPDK, respectively, and the destination IP address is an IP address of a kernel network card interface.
16. The method of claim 11, wherein after replacing the first quintuple information in the packet with the second quintuple information, the method further comprises:
and replacing the source MAC address and the destination MAC address in the data packet with the MAC address of the second virtual network card and the MAC address of the first virtual network card respectively, and sending the data packet with the replaced MAC addresses through the second virtual network card.
17. The method of claim 11, wherein after replacing the third quintuple information in the reply packet with the fourth quintuple information, the method further comprises:
and replacing the source MAC address and the destination MAC address in the reply data packet with the MAC address of the third virtual network card and the MAC address of the BGP peer respectively, and sending out the reply data packet with the replaced MAC address through the third virtual network card.
18. A server, characterized in that the server comprises a memory for storing a computer program for implementing the method of any of claims 11 to 17 when the computer program is executed by a processor and a processor.
CN202011425907.4A 2020-12-09 2020-12-09 Method and server for realizing BGP message interaction in DPDK Active CN112615781B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011425907.4A CN112615781B (en) 2020-12-09 2020-12-09 Method and server for realizing BGP message interaction in DPDK

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011425907.4A CN112615781B (en) 2020-12-09 2020-12-09 Method and server for realizing BGP message interaction in DPDK

Publications (2)

Publication Number Publication Date
CN112615781A CN112615781A (en) 2021-04-06
CN112615781B true CN112615781B (en) 2023-04-18

Family

ID=75229625

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011425907.4A Active CN112615781B (en) 2020-12-09 2020-12-09 Method and server for realizing BGP message interaction in DPDK

Country Status (1)

Country Link
CN (1) CN112615781B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113285839A (en) * 2021-05-31 2021-08-20 河南信大网御科技有限公司 Design method of programmable data plane software switch based on DPDK
CN113778626A (en) * 2021-08-31 2021-12-10 山石网科通信技术股份有限公司 Hot plug processing method and device for virtual network card, storage medium and processor
CN114363257B (en) * 2021-12-29 2023-10-17 杭州迪普信息技术有限公司 Five-tuple matching method and device for tunnel message

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108881026A (en) * 2018-06-01 2018-11-23 武汉绿色网络信息服务有限责任公司 A kind of BGP message forwarding method and device for realizing router based on linux system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107483628B (en) * 2017-09-12 2020-09-18 网宿科技股份有限公司 DPDK-based one-way proxy method and system
CN108600051B (en) * 2018-04-28 2020-02-18 网宿科技股份有限公司 BGP Anycast cluster service quality detection method and detection equipment
CN109379269A (en) * 2018-11-29 2019-02-22 南京中孚信息技术有限公司 Virtual swap device data forwarding method, device and computer equipment
CN111641531B (en) * 2020-05-12 2021-08-17 国家计算机网络与信息安全管理中心 DPDK-based data packet distribution and feature extraction method
CN111565142B (en) * 2020-07-15 2020-11-03 鹏城实验室 Message processing method and device and computer readable storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108881026A (en) * 2018-06-01 2018-11-23 武汉绿色网络信息服务有限责任公司 A kind of BGP message forwarding method and device for realizing router based on linux system

Also Published As

Publication number Publication date
CN112615781A (en) 2021-04-06

Similar Documents

Publication Publication Date Title
CN112615781B (en) Method and server for realizing BGP message interaction in DPDK
JP7281531B2 (en) Multi-cloud connectivity using SRv6 and BGP
CN107566441B (en) Method and system for fast routing transmission between virtual machine and cloud service computing device
CN107645444B (en) System, device and method for fast routing transmission between virtual machines and cloud service computing devices
JP4730746B2 (en) Method, system, and computer program for bypassing a routing stack using a mobile internet protocol
US8266204B2 (en) Direct addressability and direct server return
WO2017000878A1 (en) Message processing
WO2020198218A1 (en) Consistent route announcements among redundant controllers in global network access point
CN108718278B (en) Message transmission method and device
US20210103507A1 (en) Highly-available distributed network address translation (nat) architecture with failover solutions
CN107800625B (en) Message forwarding method and device
CN111010340B (en) Data message forwarding control method and device and computing device
CN109660578A (en) CDN's returns source processing method and processing device, system
CN113315706A (en) Private cloud flow control method, device and system
CN107547339B (en) Method and device for feeding back MAC address of gateway media access control
CN109639589B (en) Load balancing method and device
CN113364660B (en) Data packet processing method and device in LVS load balancing
CN110071872B (en) Service message forwarding method and device, and electronic device
US10341292B2 (en) Increased port address space
CN113839876B (en) Transmission path optimization method and equipment for internal network
CN115242882A (en) Method and device for accessing k8s container environment based on transport layer route
US20180248765A1 (en) Method for selecting negotiation counterpart, method for responding to discovery message, and related apparatus
CN109873764B (en) Method, device and electronic equipment for establishing oriented OSPF (open shortest Path first) neighbor relation
CN114172853A (en) Flow forwarding and bare computer server configuration method and device
CN102546405B (en) Business processing method and device of protocol stack

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