CN108965094A - A kind of virtual machine network connection method and device - Google Patents

A kind of virtual machine network connection method and device Download PDF

Info

Publication number
CN108965094A
CN108965094A CN201810979484.7A CN201810979484A CN108965094A CN 108965094 A CN108965094 A CN 108965094A CN 201810979484 A CN201810979484 A CN 201810979484A CN 108965094 A CN108965094 A CN 108965094A
Authority
CN
China
Prior art keywords
virtual machine
network
microsoft loopback
loopback adapter
gateway
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.)
Pending
Application number
CN201810979484.7A
Other languages
Chinese (zh)
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.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information 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 Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201810979484.7A priority Critical patent/CN108965094A/en
Publication of CN108965094A publication Critical patent/CN108965094A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/70Virtual switches

Abstract

The invention discloses a kind of virtual machine network connection method and devices.It is related to virtual machine platform technology, solves the problems, such as that physical router scheme operation cost and network complexity are high.This method comprises: creating Microsoft Loopback Adapter on virtual switch;By the gateway association of different sub-network locating for multiple virtual machines to the Microsoft Loopback Adapter.Technical solution provided by the invention is suitable for the data interaction of virtual machine across a network, solves the problems, such as that physical router scheme operation cost and network complexity are high.

Description

A kind of virtual machine network connection method and device
Technical field
The present invention relates to virtual machine platform technology, espespecially a kind of virtual machine network connection method and device.
Background technique
Under virtualized environment, if virtual machine is in different subnets, intercommunication needs additional physics between virtual machine Router does message transfer, increases operation cost and network complexity.
Summary of the invention
In order to solve the above-mentioned technical problems, the present invention provides a kind of virtual machine network connection method and devices.Pass through void Virtual machine communicates between quasi- network interface card completes multiple and different subnets, realizes the virtual machine outgoing telecommunication without hardware, solves physics Router scheme operation cost and the high problem of network complexity.
In order to reach the object of the invention, the present invention provides a kind of virtual machine network connection methods, which is characterized in that packet It includes:
Microsoft Loopback Adapter is created on virtual switch;
By the gateway association of different sub-network locating for multiple virtual machines to the Microsoft Loopback Adapter.
Preferably, the Microsoft Loopback Adapter is internal type, the step that Microsoft Loopback Adapter is created on virtual switch Suddenly include:
The Microsoft Loopback Adapter that internal type is added on the virtual switch, is added to network for the Microsoft Loopback Adapter NameSpace.
Preferably, the gateway association by different sub-network locating for multiple virtual machines to the step of Microsoft Loopback Adapter, wraps It includes:
It is in the network namespace, the IP address of the gateway of different sub-network locating for the multiple virtual machine is additional To the Microsoft Loopback Adapter, the routing table comprising each virtual machine and locating subnet gateway mapping relations is saved.
Preferably, by after the step of the gateway association of different sub-network locating for multiple virtual machines to the Microsoft Loopback Adapter, Further include:
The first virtual machine in the first subnet sends to the second virtual machine to the first gateway of first subnet and sends Message, second virtual machine is in the second subnet;
The message is forwarded according to the purpose IP address table of query and routing of the message in the network namespace To the second gateway of second subnet.
The present invention also provides a kind of virtual machine network attachment devices, comprising:
Microsoft Loopback Adapter creation module, for creating Microsoft Loopback Adapter on virtual switch;
Gateway association module, for by the gateway association of different sub-network locating for multiple virtual machines to the Microsoft Loopback Adapter.
Preferably, the Microsoft Loopback Adapter creation module is specifically used for adding internal class on the virtual switch The Microsoft Loopback Adapter is added to network namespace by the Microsoft Loopback Adapter of type.
Preferably, the gateway association module is specifically used in the network namespace, by the multiple virtual machine The IP address of the gateway of locating different sub-network is appended to the Microsoft Loopback Adapter, saves comprising each virtual machine and locating subnet gateway The routing table of mapping relations.
Preferably, the device further include:
Packet forwarding module, for receiving first gateway of the first virtual machine for being in the first subnet to first subnet The message sent to the second virtual machine sent, second virtual machine is in the second subnet, in the network namespace, root According to the purpose IP address table of query and routing of the message, the message is forwarded to the second gateway of second subnet.
The present invention provides a kind of virtual machine network connection method and devices, and Microsoft Loopback Adapter is created on virtual switch, Again by the gateway association of different sub-network locating for multiple virtual machines to the Microsoft Loopback Adapter.Different sub-network is realized by Microsoft Loopback Adapter Between data transmission, realize the virtual machine outgoing telecommunication without hardware, solve physical router scheme operation cost and net The high problem of network complexity.
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specification It obtains it is clear that understand through the implementation of the invention.The objectives and other advantages of the invention can be by specification, right Specifically noted structure is achieved and obtained in claim and attached drawing.
Detailed description of the invention
Attached drawing is used to provide to further understand technical solution of the present invention, and constitutes part of specification, with this The embodiment of application technical solution for explaining the present invention together, does not constitute the limitation to technical solution of the present invention.
Fig. 1 is a kind of flow diagram for virtual machine network connection method that one embodiment of the invention provides;
Fig. 2 is a kind of virtual machine network connection method realization principle schematic diagram that one embodiment of the invention provides;
Fig. 3 is a kind of structural schematic diagram for virtual machine network attachment device that one embodiment of the invention provides.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention Embodiment be described in detail.It should be noted that in the absence of conflict, in the embodiment and embodiment in the application Feature can mutual any combination.
Step shown in the flowchart of the accompanying drawings can be in a computer system such as a set of computer executable instructions It executes.Also, although logical order is shown in flow charts, and it in some cases, can be to be different from herein suitable Sequence executes shown or described step.
Under virtualized environment, if virtual machine is in different subnets, intercommunication needs additional physics between virtual machine Router does message transfer, increases operation cost and network complexity.
To solve the above-mentioned problems, the embodiment provides a kind of virtual machine network connection method and device, nothings Additional hardware router need to be increased, reduce operation cost and network complexity.
One embodiment of the invention provides a kind of virtual machine network connection method, completes the void across subnet using this method The process of quasi- machine communication is as shown in Figure 1, comprising:
Step 101 creates Microsoft Loopback Adapter on virtual switch.
The Microsoft Loopback Adapter that internal type is added on the virtual switch, is added to network for the Microsoft Loopback Adapter NameSpace.
Step 102, by the gateway association of different sub-network locating for multiple virtual machines to the Microsoft Loopback Adapter.
In network namespace, the default gateway IP each subnet is additional in this Microsoft Loopback Adapter, opening network name The message forwarding capability in space.
Specifically, in the network namespace, by the IP of the gateway of different sub-network locating for the multiple virtual machine Address is appended to the Microsoft Loopback Adapter, saves the routing table comprising each virtual machine and locating subnet gateway mapping relations.
The realization principle of the embodiment of the present invention is as shown in Fig. 2, two virtual machines belong to different subnets, the default of each subnet Gateway IP configuration red round block in figure.The IP of virtual machine 1 is 192.168.1.2, and default gateway IP is 192.168.1.1;It is empty The IP of quasi- machine 2 is 172.16.12.2, and default gateway IP is 172.16.12.1.192.168.1.1 with 172.16.12.1 the two Gateway IP is added on the Microsoft Loopback Adapter of red round block.
It completes to postpone matching for Microsoft Loopback Adapter, the transmission of message can be carried out between the virtual machine in different sub-network, is located The message sent to the second virtual machine is sent to the first gateway of first subnet in the first virtual machine of the first subnet, it is described Second virtual machine is in the second subnet;In the network namespace, according to the purpose IP address table of query and routing of the message, The message is forwarded to the second gateway of second subnet.
For the application environment shown in Fig. 2, virtual machine 1 accesses virtual machine 2, since two virtual machines belong to different sons Net, then virtual machine 1 can be sent to message on the default gateway of oneself.Microsoft Loopback Adapter in network namespace receives virtually The message of machine 1 does message forwarding according to destination IP table of query and routing, is sent to virtual machine 2.
One embodiment of the invention additionally provides a kind of virtual machine network attachment device, the structure of the device as shown in figure 3, Include:
Microsoft Loopback Adapter creation module 301, for creating Microsoft Loopback Adapter on virtual switch;
Gateway association module 302, for by the gateway association of different sub-network locating for multiple virtual machines to the virtual net Card.
Preferably, the Microsoft Loopback Adapter creation module 301, specifically for adding internal on the virtual switch The Microsoft Loopback Adapter is added to network namespace by the Microsoft Loopback Adapter of type.
Preferably, the gateway association module 302 is specifically used in the network namespace, by the multiple void The IP address of the gateway of different sub-network locating for quasi- machine is appended to the Microsoft Loopback Adapter, saves comprising each virtual machine and locating subnet The routing table of gateway maps relationship.
Preferably, the device further include:
Packet forwarding module 303, for receiving the first virtual machine in the first subnet to the first of first subnet The message sent to the second virtual machine that gateway is sent, second virtual machine are in the second subnet, empty in the network naming Between, according to the purpose IP address table of query and routing of the message, the message is forwarded to the second gateway of second subnet.
The embodiment provides a kind of virtual machine network connection method and devices, create on virtual switch empty Quasi- network interface card, then by the gateway association of different sub-network locating for multiple virtual machines to the Microsoft Loopback Adapter.It is realized by Microsoft Loopback Adapter Data transmission between different sub-network, realizes the virtual machine outgoing telecommunication without hardware, solves physical router scheme operation Cost and the high problem of network complexity.
Communication between the virtual machine of different sub-network can be by network namespace transfer, without increasing additional hardware Router, cuts operating costs and network complexity.Key point of the invention is virtually to hand under virtualized environment in conjunction with OVS It changes planes and realizes routing function with network namespace, the virtual machine of different sub-network is enable to communicate with each other.
It will appreciated by the skilled person that whole or certain steps, system, dress in method disclosed hereinabove Functional module/unit in setting may be implemented as software, firmware, hardware and its combination appropriate.In hardware embodiment, Division between the functional module/unit referred in the above description not necessarily corresponds to the division of physical assemblies;For example, one Physical assemblies can have multiple functions or a function or step and can be executed by several physical assemblies cooperations.Certain groups Part or all components may be implemented as by processor, such as the software that digital signal processor or microprocessor execute, or by It is embodied as hardware, or is implemented as integrated circuit, such as specific integrated circuit.Such software can be distributed in computer-readable On medium, computer-readable medium may include computer storage medium (or non-transitory medium) and communication media (or temporarily Property medium).As known to a person of ordinary skill in the art, term computer storage medium is included in for storing information (such as Computer readable instructions, data structure, program module or other data) any method or technique in the volatibility implemented and non- Volatibility, removable and nonremovable medium.Computer storage medium include but is not limited to RAM, ROM, EEPROM, flash memory or its His memory technology, CD-ROM, digital versatile disc (DVD) or other optical disc storages, magnetic holder, tape, disk storage or other Magnetic memory apparatus or any other medium that can be used for storing desired information and can be accessed by a computer.This Outside, known to a person of ordinary skill in the art to be, communication media generally comprises computer readable instructions, data structure, program mould Other data in the modulated data signal of block or such as carrier wave or other transmission mechanisms etc, and may include any information Delivery media.

Claims (8)

1. a kind of virtual machine network connection method characterized by comprising
Microsoft Loopback Adapter is created on virtual switch;
By the gateway association of different sub-network locating for multiple virtual machines to the Microsoft Loopback Adapter.
2. virtual machine network connection method according to claim 1, which is characterized in that the Microsoft Loopback Adapter is internal Type, it is described to include: the step of creating Microsoft Loopback Adapter on virtual switch
The Microsoft Loopback Adapter that internal type is added on the virtual switch, is added to network naming for the Microsoft Loopback Adapter Space.
3. virtual machine network connection method according to claim 2, which is characterized in that it is described will be locating for multiple virtual machines The gateway association of different sub-network to the step of Microsoft Loopback Adapter includes:
In the network namespace, the IP address of the gateway of different sub-network locating for the multiple virtual machine is appended to institute Microsoft Loopback Adapter is stated, the routing table comprising each virtual machine and locating subnet gateway mapping relations is saved.
4. virtual machine network connection method according to claim 2, which is characterized in that by difference locating for multiple virtual machines After the step of gateway association of subnet to Microsoft Loopback Adapter, further includes:
The first virtual machine in the first subnet sends the report sent to the second virtual machine to the first gateway of first subnet Text, second virtual machine are in the second subnet;
In the network namespace, according to the purpose IP address table of query and routing of the message, the message is forwarded to institute State the second gateway of the second subnet.
5. a kind of virtual machine network attachment device characterized by comprising
Microsoft Loopback Adapter creation module, for creating Microsoft Loopback Adapter on virtual switch;
Gateway association module, for by the gateway association of different sub-network locating for multiple virtual machines to the Microsoft Loopback Adapter.
6. virtual machine network attachment device according to claim 5, which is characterized in that the Microsoft Loopback Adapter creation module, Specifically for adding the Microsoft Loopback Adapter of internal type on the virtual switch, the Microsoft Loopback Adapter is added to network NameSpace.
7. virtual machine network attachment device according to claim 6, which is characterized in that the gateway association module, specifically For in the network namespace, the IP address of the gateway of different sub-network locating for the multiple virtual machine to be appended to institute Microsoft Loopback Adapter is stated, the routing table comprising each virtual machine and locating subnet gateway mapping relations is saved.
8. virtual machine network attachment device according to claim 6, which is characterized in that the device further include:
Packet forwarding module is sent for receiving the first virtual machine in the first subnet to the first gateway of first subnet To the second virtual machine send message, second virtual machine is in the second subnet, in the network namespace, according to institute The message is forwarded to the second gateway of second subnet by the purpose IP address table of query and routing for stating message.
CN201810979484.7A 2018-08-23 2018-08-23 A kind of virtual machine network connection method and device Pending CN108965094A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810979484.7A CN108965094A (en) 2018-08-23 2018-08-23 A kind of virtual machine network connection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810979484.7A CN108965094A (en) 2018-08-23 2018-08-23 A kind of virtual machine network connection method and device

Publications (1)

Publication Number Publication Date
CN108965094A true CN108965094A (en) 2018-12-07

Family

ID=64474466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810979484.7A Pending CN108965094A (en) 2018-08-23 2018-08-23 A kind of virtual machine network connection method and device

Country Status (1)

Country Link
CN (1) CN108965094A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110971514A (en) * 2019-11-29 2020-04-07 湖南基石通信技术有限公司 Pilot frequency gateway equipment and data interaction method of pilot frequency network
CN114401274A (en) * 2022-01-21 2022-04-26 浪潮云信息技术股份公司 Communication line creating method, device, equipment and readable storage medium
CN114584504A (en) * 2022-04-30 2022-06-03 苏州浪潮智能科技有限公司 Network card communication method, device, equipment and medium of AI training platform
CN114697246A (en) * 2022-02-23 2022-07-01 浙江众合科技股份有限公司 Virtual machine test environment construction method
CN114938318A (en) * 2022-05-11 2022-08-23 浪潮云信息技术股份公司 Cross-regional peer-to-peer connection implementation method based on elastic public network IP

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102469004A (en) * 2010-10-29 2012-05-23 中国科学院计算技术研究所 Virtual machine network system and creation method thereof
CN103595772A (en) * 2013-11-01 2014-02-19 浪潮电子信息产业股份有限公司 Cloud data center network deployment scheme based on virtual router
CN103746997A (en) * 2014-01-10 2014-04-23 浪潮电子信息产业股份有限公司 Network security solution for cloud computing center
WO2015062529A1 (en) * 2013-10-31 2015-05-07 Hangzhou H3C Technologies Co., Ltd. Packet forwarding in data center network
CN104869058A (en) * 2015-06-04 2015-08-26 北京京东尚科信息技术有限公司 Method and device for transmitting data message
CN105721487A (en) * 2016-03-07 2016-06-29 联想(北京)有限公司 Information processing method and electronic equipment
US20160294731A1 (en) * 2015-04-01 2016-10-06 Brocade Communications Systems, Inc. Techniques For Facilitating Port Mirroring In Virtual Networks

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102469004A (en) * 2010-10-29 2012-05-23 中国科学院计算技术研究所 Virtual machine network system and creation method thereof
WO2015062529A1 (en) * 2013-10-31 2015-05-07 Hangzhou H3C Technologies Co., Ltd. Packet forwarding in data center network
CN103595772A (en) * 2013-11-01 2014-02-19 浪潮电子信息产业股份有限公司 Cloud data center network deployment scheme based on virtual router
CN103746997A (en) * 2014-01-10 2014-04-23 浪潮电子信息产业股份有限公司 Network security solution for cloud computing center
US20160294731A1 (en) * 2015-04-01 2016-10-06 Brocade Communications Systems, Inc. Techniques For Facilitating Port Mirroring In Virtual Networks
CN104869058A (en) * 2015-06-04 2015-08-26 北京京东尚科信息技术有限公司 Method and device for transmitting data message
CN105721487A (en) * 2016-03-07 2016-06-29 联想(北京)有限公司 Information processing method and electronic equipment

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110971514A (en) * 2019-11-29 2020-04-07 湖南基石通信技术有限公司 Pilot frequency gateway equipment and data interaction method of pilot frequency network
CN110971514B (en) * 2019-11-29 2022-04-05 湖南基石通信技术有限公司 Pilot frequency gateway equipment and data interaction method of pilot frequency network
CN114401274A (en) * 2022-01-21 2022-04-26 浪潮云信息技术股份公司 Communication line creating method, device, equipment and readable storage medium
CN114401274B (en) * 2022-01-21 2023-11-07 浪潮云信息技术股份公司 Communication line creation method, device, equipment and readable storage medium
CN114697246A (en) * 2022-02-23 2022-07-01 浙江众合科技股份有限公司 Virtual machine test environment construction method
CN114584504A (en) * 2022-04-30 2022-06-03 苏州浪潮智能科技有限公司 Network card communication method, device, equipment and medium of AI training platform
CN114938318A (en) * 2022-05-11 2022-08-23 浪潮云信息技术股份公司 Cross-regional peer-to-peer connection implementation method based on elastic public network IP
CN114938318B (en) * 2022-05-11 2024-03-26 浪潮云信息技术股份公司 Cross-region peer-to-peer connection realization method based on elastic public network IP

Similar Documents

Publication Publication Date Title
US11895154B2 (en) Method and system for virtual machine aware policy management
CN108965094A (en) A kind of virtual machine network connection method and device
CN103580980B (en) The method and device thereof that virtual network finds and automatically configures automatically
US8363656B2 (en) Multiple virtual machines sharing a single IP address
CN103026660B (en) Network policy configuration method, management equipment and network management centre device
US20210029077A1 (en) Managing network connectivity between cloud computing service endpoints and virtual machines
KR102082282B1 (en) Method and system for managing resource objects
US11671363B2 (en) Method and apparatus for cross-service-zone communication, and data center network
CN106878199B (en) Configuration method and device of access information
CN110572439B (en) Cloud monitoring method based on metadata service and virtual forwarding network bridge
CN110336730B (en) Network system and data transmission method
CN109150638A (en) A kind of route management method and device
EP3905598A1 (en) Message processing method and apparatus, control plane device, and computer storage medium
CN108270690A (en) The method and apparatus for controlling message flow
CN109450905A (en) Transmit the method and apparatus and system of data
CN111464622A (en) Volume mapping processing method and device in distributed storage system
CN104734930B (en) Method and device for realizing access of Virtual Local Area Network (VLAN) to Variable Frequency (VF) network and Fiber Channel Frequency (FCF)
CN109450768B (en) Method for interconnecting containers and system for interconnecting containers
CN112583655B (en) Data transmission method and device, electronic equipment and readable storage medium
US11005706B2 (en) Method for configuring forwarding table for user equipment, apparatus, and system
CN109151094A (en) Retransmission method, device and the computer equipment of message between a kind of different sub-network
CN108989176A (en) A kind of virtual machine exchange visit methods, devices and systems
US10079725B1 (en) Route map policies for network switches
WO2023098645A1 (en) Container network configuration method and apparatus, computing node, master node, and storage medium
CN114172802B (en) Container network configuration method, device, computing node, master node and storage medium

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20181207

RJ01 Rejection of invention patent application after publication