Disclosure of Invention
The application provides a method and a device for interfacing a container network by MLAG networking.
In a first aspect, the present application provides a method for interfacing a container network with an MLAG networking, applied to an SDN controller, where the method includes:
configuring a target IP address allocated to an MLAG switch, wherein the target IP address and an IP address when a server accesses the MLAG switch belong to the same network segment;
after detecting that a target server accesses a target MLAG switch, distributing the target IP to the target MLAG switch so that the target MLAG switch establishes a BGP connection relation with the target server based on the target IP address, and the target server sends a local container network route to the target MLAG switch based on the BGP connection relation established with the target MLAG switch.
Optionally, the MLAG switch includes a first MLAG switch and a second MLAG switch; the step of configuring the destination IP address for assignment to the MLAG switch includes:
a first IP address is configured for assignment to a first MLAG switch and a second IP address is configured for assignment to a second MLAG switch.
Optionally, the method further comprises:
acquiring a topological relation of MLAG switches, wherein the topological relation of the MLAG switches comprises information of each group of MLAG switches;
adding BGP connection configuration, wherein the source address of the BGP connection configuration is a subnet where the target IP address is located, and the BGP connection configuration comprises all BGP connection relations of the subnet where the target IP address is located;
and when the fact that the server is on line in the MLAG switch is detected, based on the BGP connection configuration source address, issuing the BGP connection configuration to the MLAG switch.
Optionally, the method further comprises:
after the target server sends the local container network route to the target MLAG switch based on the BGP connection relation established with the target MLAG switch, the target MLAG switch sends the container network route to other BGP neighbors of the subnet where the target IP address is located based on the BGP connection configuration.
Optionally, the step of assigning the target IP to the target MLAG switch includes:
and distributing the first IP address to a loopback interface of the first MLAG switch, and distributing the second IP address to a loopback interface of the second MLAG switch.
In a second aspect, the present application provides an apparatus for interfacing a container network with an MLAG networking, applied to an SDN controller, where the apparatus includes:
a configuration unit, configured to configure a target IP address allocated to an MLAG switch, where the target IP address and an IP address when a server accesses the MLAG switch belong to the same network segment;
and the distribution unit is used for distributing the target IP to the target MLAG switch after detecting that the target server accesses the target MLAG switch, so that the target MLAG switch establishes a BGP connection relation with the target server based on the target IP address, and the target server sends a local container network route to the target MLAG switch based on the BGP connection relation established with the target MLAG switch.
Optionally, the MLAG switch includes a first MLAG switch and a second MLAG switch; when configuring the target IP address allocated to the MLAG switch, the configuration unit is specifically configured to:
a first IP address is configured for assignment to a first MLAG switch and a second IP address is configured for assignment to a second MLAG switch.
Optionally, the apparatus further comprises:
an obtaining unit, configured to obtain a topology relationship of an MLAG switch, where the topology relationship of the MLAG switch includes information of each group of MLAG switches;
an adding unit, configured to add BGP connection configuration, where a source address of the BGP connection configuration is a subnet where the target IP address is located, and the BGP connection configuration includes all BGP connection relationships of the subnet where the target IP address is located;
and the issuing unit is used for issuing the BGP connection configuration to the MLAG switch based on the BGP connection configuration source address when the server is detected to be online in the MLAG switch.
Optionally, after the target server sends the local container network route to the target MLAG switch based on the BGP connection relationship established with the target MLAG switch, the target MLAG switch sends the container network route to other BGP neighbors of the subnet where the target IP address is located based on the BGP connection configuration.
Optionally, when the target IP is allocated to the target MLAG switch, the allocation unit is specifically configured to:
and distributing the first IP address to a loopback interface of the first MLAG switch, and distributing the second IP address to a loopback interface of the second MLAG switch.
In a third aspect, an embodiment of the present application provides an apparatus for interfacing a container network with an MLAG networking, where the apparatus includes:
a memory for storing program instructions;
a processor for invoking program instructions stored in said memory, performing the steps of the method according to any of the first aspects above in accordance with the obtained program instructions.
In a fourth aspect, embodiments of the present application also provide a computer-readable storage medium storing computer-executable instructions for causing a computer to perform the steps of the method according to any one of the first aspects.
As can be seen from the above, in the method for interfacing a container network by MLAG networking provided by the embodiment of the present application, a target IP address allocated to an MLAG switch is configured, where the target IP address and an IP address when a server accesses the MLAG switch belong to the same network segment; after detecting that a target server accesses a target MLAG switch, distributing the target IP to the target MLAG switch so that the target MLAG switch establishes a BGP connection relation with the target server based on the target IP address, and the target server sends a local container network route to the target MLAG switch based on the BGP connection relation established with the target MLAG switch.
By adopting the method for interfacing the container network by the MLAG networking, which is provided by the embodiment of the application, the IP address which is used for being allocated to the MLAG switch is reserved on the SDN controller, and the IP address when the server is accessed to the MLAG switch belong to the same network segment, so that the extra network segment resources which are required to be appointed when the establishment of BGP connection is saved, when the access of the server to the MLAG switch is detected, the reserved IP address is sent to the MLAG switch, and the MLAG switch can establish BGP link with the IP address of the server according to the reserved IP address, thereby realizing the synchronization of the routing information of the container network.
Detailed Description
The terminology used in the embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to any or all possible combinations including one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in embodiments of the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the application. Depending on the context, furthermore, the word "if" used may be interpreted as "at … …" or "at … …" or "in response to a determination".
For example, referring to fig. 1, a detailed flowchart of a method for interfacing a container network with an MLAG networking according to an embodiment of the present application is applied to an SDN controller, where the method includes the following steps:
step 100: and configuring a target IP address allocated to the MLAG switch, wherein the target IP address and the IP address when a server accesses the MLAG switch belong to the same network segment.
In the embodiment of the application, the MLAG switch comprises a first MLAG switch and a second MLAG switch. Then, in configuring the destination IP address for assignment to the MLAG switch, one preferred implementation is: a first IP address is configured for assignment to a first MLAG switch and a second IP address is configured for assignment to a second MLAG switch.
In practical application, a plurality of containers (i.e. forming a container network) are deployed on the server, each container has its corresponding routing address, and each container is used for running business services. The server adopts the MLAG technology to realize load sharing, the IP address of the server is configured as IP0 in a target network segment in advance, the IP address of the VSI port of the MLAG switch is configured as IP1 in the target network segment, and at the moment, the server can access the MLAG switch and be on line in the MLAG switch.
In the embodiment of the present application, a target IP address (e.g., IP1, IP 2) is reserved in a target network segment, and an address is reserved for an MLAG switch.
For example, the SDN controller newly adds a subnet field: the MLAG switch IP address reservation supports automatic reservation of 2 IP addresses from the subnet address pool for the MLAG switch.
That is, the destination IP address for allocation to the MLAG switch is configured on the SDN controller in advance, i.e., 2 IP addresses are reserved in the destination network segment for allocation to the MLAG switch.
Step 110: after detecting that a target server accesses a target MLAG switch, the target IP is distributed to the target MLAG switch.
In the embodiment of the application, after the target IP is allocated to the target MLAG switch, the target MLAG switch establishes a BGP connection relationship with the target server based on the target IP address, and the target server sends a local container network route to the target MLAG switch based on the BGP connection relationship established with the target MLAG switch.
In the embodiment of the present application, the MLAG switch includes a first MLAG switch and a second MLAG switch, and the target IP address allocated to the MLAG switch includes a first IP address and a second IP address, and when the target IP is allocated to the target MLAG switch, a preferred implementation manner is: and distributing the first IP address to a loopback interface of the first MLAG switch, and distributing the second IP address to a loopback interface of the second MLAG switch.
After assigning the target IP address to the MLAG switches, the SDN controller may establish BGP connection with the target server (IP 0 assigned to the server) based on the assigned target IP address (e.g., IP1 or IP 2) by each MLAG switch. After the MLAG switch establishes the BGP neighbor relation, the target server may send the local container network route (the routing address of each container deployed locally by the server) to the MLAG switch.
Further, in an embodiment of the present application, the method may further include the following steps:
acquiring a topological relation of MLAG switches, wherein the topological relation of the MLAG switches comprises information of each group of MLAG switches; adding BGP connection configuration, wherein the source address of the BGP connection configuration is a subnet where the target IP address is located, and the BGP connection configuration comprises all BGP connection relations of the subnet where the target IP address is located; when the server is detected to be online on the MLAG switch, the source address (the source address is the IP address of the MLAG switch reserved on SDN control, namely the target IP address) is configured based on the BGP connection, and the BGP connection configuration is issued to the MLAG switch.
It should be noted that, the configuration information of the MLAG members is obtained and recorded, and the MLAG member topology relationships, for example, MLAG switch 1 and MLAG switch 2 form a first MLAG group, and MLAG switch 3 and MLAG switch 4 form a second MLAG group. The BGP connection configuration specifically includes all BGP connection relationships in the target network segment, that is, after the MLAG switch acquires the container network route of the server, the acquired container network route needs to be synchronized to other BGP neighbor devices (e.g., switches) in the network segment where the container network route is located.
That is, when the SND controller issues BGP link configuration to the switch, no switch is required to be specified, and the automatic issuing of BGP connection configuration based on the MLAG reserved address as the source address to the MLAG member device is realized, so that the complexity of the interface between the SDN controller and the open source Calico network is greatly simplified, and the interface environment only needs constant bar configuration.
Further, the method may further include the steps of:
after the target server sends the local container network route to the target MLAG switch based on the BGP connection relation established with the target MLAG switch, the target MLAG switch sends the container network route to other BGP neighbors of the subnet where the target IP address is located based on the BGP connection configuration.
In this way, an MLAG networking interfacing container network is implemented such that a routing link is established between the MLAG switch and a container deployed on a server.
Exemplary, referring to fig. 2, a schematic structural diagram of an apparatus for interfacing a container network with an MLAG networking according to an embodiment of the present application is shown, where the apparatus includes:
a configuration unit 20, configured to configure a target IP address allocated to an MLAG switch, where the target IP address and an IP address when a server accesses the MLAG switch belong to the same network segment;
and the allocation unit 21 is configured to allocate the target IP to the target MLAG switch after detecting that the target server accesses the target MLAG switch, so that the target MLAG switch establishes a BGP connection relationship with the target server based on the target IP address, and the target server sends a local container network route to the target MLAG switch based on the BGP connection relationship established with the target MLAG switch.
Optionally, the MLAG switch includes a first MLAG switch and a second MLAG switch; when configuring the target IP address for allocation to the MLAG switch, the configuration unit 20 is specifically configured to:
a first IP address is configured for assignment to a first MLAG switch and a second IP address is configured for assignment to a second MLAG switch.
Optionally, the apparatus further comprises:
an obtaining unit, configured to obtain a topology relationship of an MLAG switch, where the topology relationship of the MLAG switch includes information of each group of MLAG switches;
an adding unit, configured to add BGP connection configuration, where a source address of the BGP connection configuration is a subnet where the target IP address is located, and the BGP connection configuration includes all BGP connection relationships of the subnet where the target IP address is located;
and the issuing unit is used for issuing the BGP connection configuration to the MLAG switch based on the BGP connection configuration source address when the server is detected to be online in the MLAG switch.
Optionally, after the target server sends the local container network route to the target MLAG switch based on the BGP connection relationship established with the target MLAG switch, the target MLAG switch sends the container network route to other BGP neighbors of the subnet where the target IP address is located based on the BGP connection configuration.
Alternatively, when the target IP is allocated to the target MLAG switch, the allocation unit 21 is specifically configured to:
and distributing the first IP address to a loopback interface of the first MLAG switch, and distributing the second IP address to a loopback interface of the second MLAG switch.
The above units may be one or more integrated circuits configured to implement the above methods, for example: one or more application specific integrated circuits (Application Specific Integrated Circuit, abbreviated as ASIC), or one or more microprocessors (digital singnal processor, abbreviated as DSP), or one or more field programmable gate arrays (Field Programmable Gate Array, abbreviated as FPGA), or the like. For another example, when a unit is implemented in the form of a processing element scheduler code, the processing element may be a general purpose processor, such as a central processing unit (Central Processing Unit, CPU) or other processor that may invoke the program code. For another example, the units may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Further, in the device for interfacing a container network by MLAG networking provided by the embodiment of the present application, as for a hardware architecture schematic diagram of the device for interfacing a container network by MLAG networking may be shown in fig. 3, the device for interfacing a container network by MLAG networking may include: a memory 30 and a processor 31,
the memory 30 is used for storing program instructions; the processor 31 invokes the program instructions stored in the memory 40 to perform the above-described method embodiments in accordance with the obtained program instructions. The specific implementation manner and the technical effect are similar, and are not repeated here.
Optionally, the present application further provides an apparatus for interfacing a container network with an MLAG networking, including at least one processing element (or chip) for performing the above-described method embodiments.
Alternatively, the application also provides a program product, such as a computer-readable storage medium, having stored thereon computer-executable instructions for causing a computer to perform the above-described method embodiments.
Here, a machine-readable storage medium may be any electronic, magnetic, optical, or other physical storage device that may contain or store information, such as executable instructions, data, or the like. For example, a machine-readable storage medium may be: RAM (Radom Access Memory, random access memory), volatile memory, non-volatile memory, flash memory, a storage drive (e.g., hard drive), a solid state drive, any type of storage disk (e.g., optical disk, dvd, etc.), or a similar storage medium, or a combination thereof.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in the same piece or pieces of software and/or hardware when implementing the present application.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the application may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. 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.
Moreover, 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.
The foregoing description of the preferred embodiments of the application is not intended to be limiting, but rather to enable any modification, equivalent replacement, improvement or the like to be made within the spirit and principles of the application.