Summary of the invention
The application describes a kind of network collocating method and device, matches for realizing the container to network operating systemIt sets.
In a first aspect, the application provides a kind of network collocating method, which comprises
Receive the first container send network configuration request, the first container for realizing virtual network device networkOperating system;
Send the network configuration request to second container, the network configuration request for make the second container according toThe network configuration information in the network configuration request received carries out network configuration to the first container, wherein describedSecond container has network configuration permission to the first container.In the above method, container engine is passed through for net by the first containerNetwork configuring request is sent to second container, by second container according to the network configuration information in network configuration request to the first containerComplete network configuration.It realizes and network configuration is carried out to the container of operational network operating system inside container.Meanwhile above-mentionedIn method, when the first container has the new network demand needed to configure, network configuration request is sent out again by container engineIt send to second container, realizes the dynamic network configuration to the first container, also, due to container configuration needs in configuration process and matchSetting opportunity etc. is all determined by the first container, so that it is guaranteed that the network demand needed to configure in the first container can be configured in time.
Optionally, in this application, before receiving the network configuration request that the first container is sent, which comprises
Start the first container and second container, and obtain the first container capsule address and the second containerCapsule address;
The capsule address of the second container is sent to the first container, so that the first container generates the netNetwork configuring request, the network configuration request include the capsule address of the first container, the capsule address of the second container and lead toCross the network configuration information that the interface management process of the first container obtains
Optionally, described that the network configuration request is sent to the second container in application, so that described secondContainer carries out network configuration, packet to the first container according to the network configuration information in the network configuration request receivedIt includes:
According to the capsule address of the second container, the network configuration request is sent to the second container, so thatThe second container carries out network configuration to the first container according to the network configuration information in the network configuration request.
Optionally, in this application, the network configuration request for receiving the first container and sending, comprising:
Receive the network configuration request that the interface management process of the first container is sent, wherein the network configuration is askedIt asks and is sent for the interface management process by docker command mode.
Optionally, in this application, the network configuration request further includes the address of network configuration agency, described to secondContainer sends the network configuration request, and the network configuration request is for making the second container according to the net receivedNetwork configuration information in network configuring request carries out network configuration to the first container, comprising:
According to the address that the network configuration is acted on behalf of, the network configuration request is sent to the net in the second containerNetwork Configuration Agent is believed by network configuration agency according to the capsule address of the first container and the network configuration needed to configureBreath carries out network configuration to the first container.
Second aspect, the application also provide a kind of network configuration device, and described device includes:
Receiving module, for receiving the network configuration request of the first container transmission, the first container is for realizing virtualThe network operating system of the network equipment;
Sending module, for sending the network configuration request to second container, the network configuration request is for making instituteIt states second container and network is carried out to the first container according to the network configuration information in the network configuration request receivedConfiguration, wherein the second container has network configuration permission to the first container.
Optionally, in this application, described device further include:
Starting module for starting the first container and second container, and obtains the capsule address of the first containerWith the capsule address of the second container;
The sending module is also used to the capsule address of the second container being sent to the first container, so that instituteIt states the first container and generates the network configuration request, the network configuration request includes the capsule address of the first container, described theThe capsule address of two containers and the network configuration information of the interface management process acquisition by the first container.
Optionally, in this application, the sending module is used for:
The network configuration request is sent to the second container according to the capsule address of the second container, so that instituteIt states second container and network configuration is carried out to the first container according to the network configuration information in the network configuration request.
Optionally, in this application, the receiving module is used for:
Receive the network configuration request that the interface management process of the first container is sent, wherein the network configuration is askedIt asks and is sent for the interface management process by docker command mode.
Optionally, in this application, the network configuration request further includes the address of network configuration agency, the transmission mouldBlock is also used to:
The network configuration request is sent to the net in the second container by the address acted on behalf of according to the network configurationNetwork Configuration Agent is believed by network configuration agency according to the capsule address of the first container and the network configuration needed to configureBreath carries out network configuration to the first container.
The third aspect, the application also provide a kind of network equipment, and the network equipment includes processor and is stored with severalThe nonvolatile memory of computer instruction, when the computer instruction is executed by the processor, the network equipment is executedNetwork collocating method described in first aspect.
Fourth aspect, the application also provide a kind of readable storage medium storing program for executing, and the readable storage medium storing program for executing includes computer program,The network equipment executes network described in first aspect and matches the computer program controls the readable storage medium storing program for executing when running whereSet method.
In terms of existing technologies, the application has the advantages that
Network collocating method and device provided by the present application, in the method, firstly, receiving the net that the first container is sentNetwork configuring request;Then, the network configuration request is sent to second container, the network configuration request is for making described secondContainer carries out network configuration to the first container according to the network configuration information in the network configuration request received.OnIt states in method, realizes and network configuration is carried out to the container of operational network operating system inside container.Meanwhile in the above methodIn, when the first container has the new network demand needed to configure, network configuration request is sent to again by container engineSecond container realizes the dynamic network configuration to the first container, also, due to container configuration needs in configuration process and when configuringMachine etc. is all determined by the first container, so that it is guaranteed that the network demand needed to configure in the first container can be configured in time.
Specific embodiment
To keep the purposes, technical schemes and advantages of the embodiment of the present application clearer, below in conjunction with the embodiment of the present applicationIn attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment isSome embodiments of the present application, instead of all the embodiments.The application being usually described and illustrated herein in the accompanying drawings is implementedThe component of example can be arranged and be designed with a variety of different configurations.
Therefore, the detailed description of the embodiment of the present application provided in the accompanying drawings is not intended to limit below claimedScope of the present application, but it is merely representative of the selected embodiment of the application.Based on the embodiment of the present application, ordinary skill peopleMember's every other embodiment obtained without creative efforts, belongs to the model of the embodiment of the present application protectionIt encloses.
It should also be noted that similar label and letter indicate similar terms in following attached drawing, therefore, once a certain Xiang YiIt is defined in a attached drawing, does not then need that it is further defined and explained in subsequent attached drawing.Meanwhile in the application realityIt applies in the description of example, term " first ", " second " etc. are only used for distinguishing description, are not understood to indicate or imply relatively importantProperty.
In the description of the embodiment of the present application, it is also necessary to which explanation is unless specifically defined or limited otherwise, term" setting ", " installation ", " connected ", " connection " shall be understood in a broad sense, for example, it may be being fixedly connected, be also possible to detachably connectIt connects, or is integrally connected;It can be mechanical connection, be also possible to be electrically connected;It can be directly connected, intermediate matchmaker can also be passed throughJie is indirectly connected, and can be the connection inside two elements.It for the ordinary skill in the art, can be with concrete conditionUnderstand the concrete meaning of above-mentioned term in the embodiment of the present application.
Fig. 1 is please referred to, Fig. 1 is a kind of structural schematic diagram of the network equipment 100 provided by the embodiments of the present application.The networkEquipment 100 includes network configuration device 110, memory 111, processor 112 and communication unit 113.
Each element of the memory 111, processor 112 and communication unit 113 is directly or indirectly electrical between each otherConnection, to realize the transmission or interaction of data.For example, these elements can pass through one or more communication bus or letter between each otherNumber line, which is realized, to be electrically connected.
Wherein, the memory 111 may be, but not limited to, random access memory (English: Random AccessMemory, referred to as: RAM), read-only memory (English: Read Only Memory, referred to as: ROM), programmable read only memory(English: Programmable Read-Only Memory, referred to as: PROM), erasable read-only memory (English: ErasableProgrammable Read-Only Memory, referred to as: EPROM), electricallyerasable ROM (EEROM) (English: ElectricErasable Programmable Read-Only Memory, referred to as: EEPROM) etc..Wherein, memory 111 is for storingProgram, the processor 112 execute described program after receiving and executing instruction.The communication unit 113 is for passing through networkThe communication connection between the network equipment 100 and other equipment (such as user terminal) is established, and for carrying out by networkData send and receive.
Network configuration device 110 includes that at least one can be stored in described deposit in the form of software or firmware (firmware)In reservoir 111 or it is solidificated in the operating system (English: Operating System, abbreviation: OS) of the network equipment 100Software function module.The processor 112 is used to execute the executable module stored in the memory 111, such as network is matchedSet software function module included by device 110 and computer program etc..
It should be understood that structure shown in FIG. 1 is only to illustrate, the network equipment 100 may also include than shown in Fig. 1More perhaps less component or with the configuration different from shown in Fig. 1.Each component shown in Fig. 1 can using hardware,Software or combinations thereof is realized.
Referring to figure 2., Fig. 2 is a kind of container frame figure provided by the embodiments of the present application operated on the network equipment 100,Container does not simulate the physical devices such as CPU, memory, general only to run one group of User space program, and the place and there is no the kernel of oneselfHost shares a kernel.The appearance of container is primarily to meet the blank between virtual machine isolation and process isolation, whereinVirtual machine isolation belongs to heavyweight isolation, has the shortcomings that hardware resource (for example, memory, hard disk and CPU) consumption is big;Process everyFrom lightweight isolation is belonged to, have the shortcomings that isolation effect is undesirable.
Container will be encapsulated using required running environment, cache environment, database environment etc., in most succinct modeSupport application operation.One container can be equivalent to the software systems (for example, comware software systems) of an independent completion.In the embodiment of the present application, multiple containers can be run on the network equipment 100.
In container frame figure, including for realizing the network operating system of virtual network device on the network equipment 100The first container 200, with to the first container 200 carry out network configuration permission second container 300 and container engine 400.
It in the embodiment of the present application, include interface management process in the first container 200, the interface management process is for obtainingNetwork configuration information needed for the network operating system that the first container 200 is realized.
Specifically, the opportunity of the interface configuration information needed for interface management process obtains can be the starting of the first container 200When, it can also be in 200 operational process of the first container.Interface management process can pass through detection when the first container 200 startsThe version of network operating system obtains the network configuration information needed to configure;Interface management process can also be in the first container 200In operational process by the business demand of detection the first container 200 (such as, if need newly-increased interface) obtain and need to configureNetwork configuration information.Network configuration information may include needing to configure on interface quantity, interface type and corresponding each interfaceParticular content etc..
It include that network configuration is acted on behalf of in second container 300, network configuration agency is for sending according to the first container 200Network configuration information completes the network configuration to the first container 200, and network configuration agency can pass through foot in the application implementationThis form is realized.
Container engine 400 for starting the first container 200 and second container 300, and with the first container 200 and second container300 carry out telecommunication management.
Specifically, in the embodiment of the present application, container engine 400 can carry out two-way communication with the first container 200,Container engine 400 can be used for starting the first container 200, and container engine 400 is also used to receive the first container 200 and is sent to the second appearanceThe network configuration request of device 300.Second container 300 can realize one-way communication, 300 basis of second container with the first container 200Network configuration information in network configuration request carries out network configuration to the first container 200.
Referring to figure 3., Fig. 3 is the network configuration side provided by the embodiments of the present application applied to the network equipment 100 in Fig. 1The flow chart of method, in conjunction with Fig. 2, below to the method includes each step illustrated in detail.
Step S310 receives the network configuration request that the first container is sent.
Container engine 400 receives the network configuration request that the first container 200 is sent, wherein network configuration request includes theThe network configuration information that the capsule address of one container 200, the capsule address of second container 300 and the first container 200 need to configure.Network configuration information can be the interface management process in the first container 200 when the first container 200 starts according to network operationThe network configuration information that the version of system obtains, is also possible to interface management process in 200 operational process of the first container because of industryBusiness needs the network configuration information obtained.
In network configuration request, the capsule address of the first container 200 is source address, the capsule address of second container 300For purpose address, network configuration information is particular content.Capsule address is recorded, in network configuration request so as to the first containerNetwork configuration information is sent to second container 300 by container engine 400 by 200, and is realized by second container 300 to itselfThe configuration of network.In the embodiment of the present application, the first container 200 can by between docker order and container engine 400 intoRow communication interaction.
Specifically, the first container 200 can pass through docker application programming interface (English: ApplicationProgramming Interface, referred to as: API) docker order is sent, it is asked in the docker order including network configurationIt asks.
Step S320 sends network configuration request to second container, and network configuration request is for making second container according to connecingThe network configuration information in network configuration request received carries out network configuration to the first container.
Container engine 400, will according to the destination address in the network configuration request after receiving the network configuration requestNetwork configuration request forwarding is sent to second container 300.
Second container 300 is after receiving the network configuration request, according to the network configuration information in network configuration requestAnd the capsule address of the first container 200, network configuration is carried out to the first container 200.
In the embodiment of the present application, the network configuration request can also include the address of network configuration agency, and network is matchedAgency is set to be configured in second container 300.
Then step S320 can also be accomplished by the following way:
Container engine 400 is after receiving the network configuration request, according to the destination address and net in network configuration requestThe address of network Configuration Agent was acted on behalf of the network configuration that network configuration request is sent to second container 300, by the network configuration generationReason carries out network configuration to the first container according to the capsule address and network configuration information of the first container 200.
Specifically, in the embodiment of the present application, network configuration agency can be realized in the form of script.In the above method,The bridge between the first container 200 and second container 300 is established by container engine 400, by container engine 400 and byTwo containers 300 carry out network configuration to the first container 200, configure certainly in the first container 200 so that network operating system hasThe function of body network.
Referring to figure 4., in the embodiment of the present application, before step S310, the method can also include step S308With step S309.
Step S308 starts the first container and second container, and obtains the capsule address and described the of the first containerThe capsule address of two containers.
The capsule address of second container is sent to the first container by step S309, so that described in the first container generationNetwork configuration request, the network configuration request include the capsule address of the first container, the capsule address of the second container andThe network configuration information obtained by the interface management process of the first container.
In above process, container engine 400 starts second container 300 first, with obtaining the container of second container 300Location.
In the embodiment of the present application, technical staff can formerly configure container, so that the container has network configurationPermission.Further, can also Configuration network Configuration Agent in this embodiment so that network configuration agency has network configuration powerLimit.
Container engine 400 is in starting second container 300 and then starting the first container 200.Complete the first container 200Starting after, the capsule address of second container 300 is sent to the first container 200.So that appearance of the first container 200 according to itselfThe network configuration information that device address, the capsule address of second container 300 and the first container 200 need to configure generates network configuration and asksIt asks.
Network collocating method provided by the embodiments of the present application, the network configuration information needed to configure are by the first containerInterface management process in 200 obtains, and is sent to second container 300, by second container 300 according in network configuration requestNetwork configuration information completes network configuration to the first container 200.It realizes inside container to the appearance of operational network operating systemDevice carries out network configuration.Meanwhile in above process, when the first container 200 has the new network demand needed to configure, pass throughNetwork configuration request is sent to second container 300 again by container engine, realizes the dynamic network configuration to the first container 200,Also, since container configuration needs and configuration opportunity etc. are all determined by the first container 200 in configuration process, so that it is guaranteed that first holdsThe network demand needed to configure in device 200 can be configured in time.
The above method can solve in the prior art, when being configured before container unlatching using container engine 400, because matchingIt sets the factors such as interface quantity, type and opportunity and causes existing container configuration method that can not be suitable for realization network operating systemContainer carry out network configuration situation.
The embodiment of the present application also provides a kind of network configuration device 110, unlike above example, present networks configurationDevice 110 is to describe application scheme from the angle of virtual bench.Referring to figure 5., network configuration device 110 may include withLower module.
Receiving module 1101, for receive the first container transmission network configuration request, the first container for realizingThe network operating system of virtual network device.
Receiving module 1101 receives the network configuration request that the first container 200 is sent, wherein network configuration request includes theThe network configuration information that the capsule address of one container 200, the capsule address of second container 300 and the first container 200 need to configure.As described above, network configuration information can be the root when the first container 200 starts of the interface management process in the first container 200According to the network configuration information that the version of network operating system obtains, it is also possible to interface management process and is run in the first container 200In the process because business needs the newly-increased network configuration information that obtains.
In network configuration request, the capsule address of the first container 200 is source address, the capsule address of second container 300For purpose address, the network configuration information that the first container 200 needs to configure is particular content.
In the embodiment of the present application, the first container 200 can send information to container engine 400 by docker order.Specifically, the first container 200 can send docker order, the docker order by docker application programming interfaceIn include network configuration request.
Sending module 1102, for sending the network configuration request to second container, network configuration request is for making theTwo containers carry out network configuration to the first container 200 according to the network configuration information in the network configuration request received.
Sending module 1102 is after receiving the network configuration request, according to the destination address in the network configuration request,Network configuration request forwarding is sent to second container 300.
In the embodiment of the present application, the network configuration request can also include the address of network configuration agency.Send mouldBlock 1102 is also used to, after receiving the network configuration request, according to the destination address and network configuration in network configuration requestThe network configuration that network configuration request is sent to second container 300 is acted on behalf of, acts on behalf of basis by the network configuration by the address of agencyThe capsule address and network configuration information of the first container 200 carry out network configuration to the first container 200.Specifically, in the applicationIn embodiment, network configuration agency can be realized in the form of script.
Referring once again to Fig. 5, in the embodiment of the present application, the network configuration device 110 may include:
Starting module 1103 for starting the first container and second container, and obtains the capsule address of the first containerWith the capsule address of the second container;
The sending module 1102 is also used to the capsule address of the second container being sent to the first container, withThe first container is set to generate the network configuration request, the network configuration request includes the capsule address of the first container, instituteState the capsule address of second container and the network configuration information of the interface management process acquisition by the first container.
Starting module 1103 starts second container 300 first, obtains the capsule address of second container 300.In the application realityIt applies in example, technical staff can formerly configure container, so that the container has network configuration permission.Further, may be used alsoConfiguration network Configuration Agent in this embodiment, so that network configuration agency has network configuration permission.
Starting module 1103 is in starting second container 300 and then starting the first container 200.Complete the first container 200Starting after, the capsule address of second container 300 is sent to the first container 200 by sending module 1102.So that the first container 200The network configuration information needed to configure according to the capsule address of itself, the capsule address of second container 300 and the first container 200 is rawAt network configuration request.
It, can be with if above-mentioned function is realized and when sold or used as an independent product in the form of software function moduleIt is stored in a computer readable storage medium.Based on this understanding, the technical solution of the application is substantially in other wordsThe part of the part that contributes to existing technology or the technical solution can be embodied in the form of software products, the meterCalculation machine software product is stored in a storage medium, including some instructions are used so that the execution of the network equipment 100 the application is eachThe all or part of the steps of a embodiment the method.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory(English: Read-Only Memory, abbreviation: ROM), random access memory (English: Random Access Memory, letterClaim: RAM), the various media that can store program code such as magnetic or disk.
In conclusion network collocating method provided by the embodiments of the present application and device.Firstly, receiving what the first container was sentNetwork configuration request;Then, the network configuration request is sent to second container, the network configuration request is for making described theTwo containers carry out network configuration to the first container according to the network configuration information in the network configuration request received.It realizes and network configuration is carried out to the container of operational network operating system inside container.Meanwhile in above process, firstWhen container has the new network demand needed to configure, network configuration request is sent to again by second container by container engine,Realize to the dynamic network configuration of the first container, also, due in configuration process container configuration needs and configuration opportunity etc. all byThe first container determines, so that it is guaranteed that the network demand needed to configure in the first container can be configured in time.
The above, the only specific embodiment of the application, but the protection scope of the application is not limited thereto, it is anyThose familiar with the art within the technical scope of the present application, can easily think of the change or the replacement, and should all containLid is within the scope of protection of this application.Therefore, the protection scope of the application shall be subject to the protection scope of the claim.