CN112099902A - Network adapter configuration method and device of virtual machine, electronic device and storage medium - Google Patents
Network adapter configuration method and device of virtual machine, electronic device and storage medium Download PDFInfo
- Publication number
- CN112099902A CN112099902A CN202010825980.4A CN202010825980A CN112099902A CN 112099902 A CN112099902 A CN 112099902A CN 202010825980 A CN202010825980 A CN 202010825980A CN 112099902 A CN112099902 A CN 112099902A
- Authority
- CN
- China
- Prior art keywords
- network adapter
- virtual machine
- network
- configuration file
- configuration
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 45
- 238000004891 communication Methods 0.000 claims abstract description 40
- 230000002159 abnormal effect Effects 0.000 claims abstract description 21
- 230000000694 effects Effects 0.000 claims abstract description 10
- 238000013515 script Methods 0.000 claims description 34
- 238000004590 computer program Methods 0.000 claims description 21
- 230000015654 memory Effects 0.000 claims description 20
- 238000001514 detection method Methods 0.000 claims description 4
- 238000012423 maintenance Methods 0.000 abstract description 6
- 238000005516 engineering process Methods 0.000 description 10
- 230000006870 function Effects 0.000 description 9
- 230000005540 biological transmission Effects 0.000 description 7
- 230000008569 process Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 238000012986 modification Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000008439 repair process Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000008676 import Effects 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 238000011835 investigation Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000013024 troubleshooting Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45595—Network integration; Enabling network access in virtual machine instances
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
本申请涉及一种虚拟机的网络适配器配置方法、装置、电子装置和存储介质。其中,该虚拟机的网络适配器配置方法包括:在虚拟机在启动后,检测虚拟机的网络适配器的通信状态;在检测到虚拟机的网络适配器的通信状态异常的情况下,获取虚拟机所在的真实主机的网络配置信息;根据网络配置信息配置网络适配器的配置文件;重启网络适配器对应的服务,以使网络适配器的配置文件生效。通过本申请,能够提高运维人员的工作效率,解决了虚拟机的网络适配器的配置需要依靠专业技术人员通过专业技术手段手动操作而用户无法自行操作的问题。
The present application relates to a method, device, electronic device and storage medium for configuring a network adapter of a virtual machine. The method for configuring the network adapter of the virtual machine includes: after the virtual machine is started, detecting the communication state of the network adapter of the virtual machine; when detecting that the communication state of the network adapter of the virtual machine is abnormal, obtaining the location where the virtual machine is located. Network configuration information of the real host; configure the configuration file of the network adapter according to the network configuration information; restart the service corresponding to the network adapter to make the configuration file of the network adapter take effect. Through the present application, the work efficiency of the operation and maintenance personnel can be improved, and the problem that the configuration of the network adapter of the virtual machine needs to be manually operated by professional technical personnel through professional technical means, and the user cannot operate it by himself.
Description
技术领域technical field
本申请涉及互联网技术领域,特别是涉及一种虚拟机的网络适配器配置方法、装置、电子装置和存储介质。The present application relates to the field of Internet technologies, and in particular, to a method, device, electronic device and storage medium for configuring a network adapter of a virtual machine.
背景技术Background technique
虚拟机技术在计算机和互联网领域广为应用,其中最常用的虚拟机技术是操作系统中内存的虚拟化,实际运行时用户需要的内存空间可能远远大于物理机器的内存大小,利用内存的虚拟化技术,用户可以将一部分硬盘虚拟化为内存,而这对用户是透明的。此外,还可以利用虚拟专用网技术(VPN)在公共网络中虚拟化一条安全,稳定的“隧道”,用户感觉像是使用私有网络一样。但是,虚拟机技术在使用过程中也会存在一些通讯的的问题,如在虚拟机启动之后可能会出现网络适配器的配置文件缺失、损坏等异常问题,导致系统无法与外界进行通讯。Virtual machine technology is widely used in the computer and Internet fields. The most commonly used virtual machine technology is the virtualization of memory in the operating system. The memory space required by the user during actual operation may be much larger than the memory size of the physical machine. Using the virtualization technology, users can virtualize a part of the hard disk into memory, which is transparent to the user. In addition, virtual private network technology (VPN) can be used to virtualize a secure and stable "tunnel" in the public network, and users feel like they are using a private network. However, there are also some communication problems during the use of virtual machine technology. For example, after the virtual machine is started, there may be abnormal problems such as missing or damaged configuration files of the network adapter, resulting in the system being unable to communicate with the outside world.
为了解决网络适配器异常的问题,业界也研究出了一些解决问题的策略方法。比如通过人工方式进行修改处理,生成新的网络适配器并创建自有的网络适配器配置文件内容,或者依靠人工排查的方式修改调整已有网络适配器的配置文件并进行修正。但是,依靠人工解决问题的方法需要专业技术人员和专业技术手段,用户无法自行解决问题。In order to solve the problem of abnormal network adapters, the industry has also developed some strategies and methods to solve the problem. For example, the modification is performed manually, a new network adapter is generated and the content of its own network adapter configuration file is created, or the configuration file of an existing network adapter is modified, adjusted and corrected by means of manual investigation. However, relying on manual problem-solving methods requires professional technicians and professional technical means, and users cannot solve problems by themselves.
目前针对相关技术中虚拟机的网络适配器的配置需要依靠专业技术人员通过专业技术手段手动操作而用户无法自行操作的问题,尚未提出有效的解决方案。Currently, there is no effective solution for the problem that the configuration of the network adapter of the virtual machine in the related art needs to be manually operated by professional technicians through professional technical means, and the user cannot operate it by himself.
发明内容SUMMARY OF THE INVENTION
在本申请实施例中提供了一种虚拟机的网络适配器配置方法、装置、电子装置和存储介质,以至少解决相关技术中虚拟机启动之后可能会出现网络适配器的配置文件缺失、损坏等异常的问题。Embodiments of the present application provide a method, device, electronic device, and storage medium for configuring a network adapter of a virtual machine, so as to at least solve the problem in the related art that the configuration file of the network adapter may be missing or damaged after the virtual machine is started. question.
第一方面,本申请实施例提供了一种虚拟机的网络适配器配置方法,包括:In a first aspect, an embodiment of the present application provides a method for configuring a network adapter of a virtual machine, including:
步骤A,在虚拟机在启动后,检测所述虚拟机的网络适配器的通信状态;Step A, after the virtual machine is started, the communication state of the network adapter of the virtual machine is detected;
步骤B,在检测到所述虚拟机的网络适配器的通信状态异常的情况下,获取所述虚拟机所在的真实主机的网络配置信息;Step B, in the case of detecting that the communication state of the network adapter of the virtual machine is abnormal, acquiring the network configuration information of the real host where the virtual machine is located;
步骤C,根据所述网络配置信息配置所述网络适配器的配置文件;Step C, configure the configuration file of the network adapter according to the network configuration information;
步骤D,重启所述网络适配器对应的服务,以使所述网络适配器的配置文件生效。Step D: Restart the service corresponding to the network adapter to make the configuration file of the network adapter take effect.
在其中一个实施例中,在所述步骤A之前,所述方法还包括:In one embodiment, before the step A, the method further includes:
生成用于执行所述步骤A至步骤D的脚本程序;Generate a script program for executing the steps A to D;
将所述脚本程序写入到所述虚拟机中,并设置在所述虚拟机启动时运行所述脚本程序。The script program is written into the virtual machine, and the script program is set to run when the virtual machine is started.
在其中一个实施例中,所述步骤C包括:In one embodiment, the step C includes:
判断所述网络适配器的配置文件是否存在;Determine whether the configuration file of the network adapter exists;
在判断到所述网络适配器的配置文件不存在的情况下,生成所述配置文件,并将所述配置信息写入到所述配置文件中。When it is determined that the configuration file of the network adapter does not exist, the configuration file is generated, and the configuration information is written into the configuration file.
在其中一个实施例中,所述步骤C还包括:In one embodiment, the step C further includes:
在判断到所述网络适配器的配置文件已存在的情况下,根据所述配置信息更新所述配置文件。When it is determined that the configuration file of the network adapter already exists, the configuration file is updated according to the configuration information.
在其中一个实施例中,判断所述网络适配器的配置文件是否存在包括:In one embodiment, determining whether the configuration file of the network adapter exists includes:
在所述虚拟机的系统中查询/etc/sysconfig/network-scripts路径下是否存在所述配置文件;Query whether the configuration file exists in the /etc/sysconfig/network-scripts path in the system of the virtual machine;
在/etc/sysconfig/network-scripts路径下不存在所述配置文件的情况下,确定所述网络适配器的配置文件不存在;否则确定所述网络适配器的配置文件存在。If the configuration file does not exist in the /etc/sysconfig/network-scripts path, it is determined that the configuration file of the network adapter does not exist; otherwise, it is determined that the configuration file of the network adapter exists.
在其中一个实施例中,所述真实主机的网络配置信息包括以下至少之一:网络适配器的物理地址、网络适配器名称、网络适配器类型、网络适配器对应的服务的启动配置信息。In one embodiment, the network configuration information of the real host includes at least one of the following: the physical address of the network adapter, the name of the network adapter, the type of the network adapter, and the startup configuration information of the service corresponding to the network adapter.
在其中一个实施例中,所述步骤B包括:In one embodiment, the step B includes:
在检测到所述虚拟机的网络适配器的通信状态异常的情况下,通过执行ip addr命令获取所述真实主机的网络配置信息。When it is detected that the communication state of the network adapter of the virtual machine is abnormal, the network configuration information of the real host is acquired by executing the ip addr command.
第二方面,本申请实施例提供了一种虚拟机的网络适配器配置装置,包括:In a second aspect, an embodiment of the present application provides a device for configuring a network adapter of a virtual machine, including:
检测模块,用于在虚拟机在启动后,检测所述虚拟机的网络适配器的通信状态;a detection module, configured to detect the communication state of the network adapter of the virtual machine after the virtual machine is started;
获取模块,用于在检测到所述虚拟机的网络适配器的通信状态异常的情况下,获取所述虚拟机所在的真实主机的网络配置信息;an acquisition module, configured to acquire the network configuration information of the real host where the virtual machine is located when an abnormal communication state of the network adapter of the virtual machine is detected;
配置模块,用于根据所述网络配置信息配置所述网络适配器的配置文件;a configuration module, configured to configure a configuration file of the network adapter according to the network configuration information;
重启模块,用于重启所述网络适配器对应的服务,以使所述网络适配器的配置文件生效。The restarting module is used for restarting the service corresponding to the network adapter, so that the configuration file of the network adapter takes effect.
第三方面,本申请实施例提供了一种电子装置,包括存储器、处理器以及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现如上述第一方面的虚拟机的网络适配器配置方法。In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, the virtual device of the first aspect above is implemented how to configure the machine's network adapter.
第四方面,本申请实施例提供了一种存储介质,其上存储有计算机程序,该程序被处理器执行时实现如上述第一方面的虚拟机的网络适配器配置方法。In a fourth aspect, an embodiment of the present application provides a storage medium on which a computer program is stored, and when the program is executed by a processor, implements the method for configuring a network adapter of a virtual machine according to the first aspect above.
相比于相关技术,本申请能够提高运维人员的工作效率,有效避免了针对网络服务基础较差的运维人员需要花费大量的时间去咨询排查的问题。Compared with the related art, the present application can improve the work efficiency of operation and maintenance personnel, and effectively avoid the problem that operation and maintenance personnel with poor network service foundation need to spend a lot of time to consult and investigate.
附图说明Description of drawings
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described herein are used to provide further understanding of the present application and constitute a part of the present application. The schematic embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation of the present application. In the attached image:
图1是根据本申请实施例的虚拟机的网络适配器配置方法的终端硬件结构框图;1 is a block diagram of a terminal hardware structure of a method for configuring a network adapter of a virtual machine according to an embodiment of the present application;
图2是根据本申请实施例的虚拟机的网络适配器配置方法的流程图;2 is a flowchart of a method for configuring a network adapter of a virtual machine according to an embodiment of the present application;
图3是根据本申请优选实施例一的虚拟机的网络适配器配置方法的流程图;3 is a flowchart of a method for configuring a network adapter of a virtual machine according to a preferred embodiment 1 of the present application;
图4是根据本申请优选实施例二的虚拟机的网络适配器配置方法的流程图;4 is a flowchart of a method for configuring a network adapter of a virtual machine according to the second preferred embodiment of the present application;
图5是根据本申请实施例的虚拟机的网络适配器配置装置结构框图。FIG. 5 is a structural block diagram of an apparatus for configuring a network adapter of a virtual machine according to an embodiment of the present application.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行描述和说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。基于本申请提供的实施例,本领域普通技术人员在没有作出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。此外,还可以理解的是,虽然这种开发过程中所作出的努力可能是复杂并且冗长的,然而对于与本申请公开的内容相关的本领域的普通技术人员而言,在本申请揭露的技术内容的基础上进行的一些设计,制造或者生产等变更只是常规的技术手段,不应当理解为本申请公开的内容不充分。In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application. In addition, it will also be appreciated that while such development efforts may be complex and lengthy, for those of ordinary skill in the art to which the present disclosure pertains, the techniques disclosed in this application Some changes in design, manufacture or production based on the content are only conventional technical means, and it should not be understood that the content disclosed in this application is not sufficient.
在本申请中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域普通技术人员显式地和隐式地理解的是,本申请所描述的实施例在不冲突的情况下,可以与其它实施例相结合。Reference in this application to an "embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor a separate or alternative embodiment that is mutually exclusive of other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
除非另作定义,本申请所涉及的技术术语或者科学术语应当为本申请所属技术领域内具有一般技能的人士所理解的通常意义。本申请所涉及的“一”、“一个”、“一种”、“该”等类似词语并不表示数量限制,可表示单数或复数。本申请所涉及的术语“包括”、“包含”、“具有”以及它们任何变形,意图在于覆盖不排他的包含;例如包含了一系列步骤或模块(单元)的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可以还包括没有列出的步骤或单元,或可以还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。本申请所涉及的“连接”、“相连”、“耦接”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电气的连接,不管是直接的还是间接的。本申请所涉及的“多个”是指大于或者等于两个。“和/或”描述关联对象的关联关系,表示可以存在三种关系,例如,“A和/或B”可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。本申请所涉及的术语“第一”、“第二”、“第三”等仅仅是区别类似的对象,不代表针对对象的特定排序。Unless otherwise defined, the technical or scientific terms involved in this application shall have the usual meanings understood by those with ordinary skill in the technical field to which this application belongs. Words such as "a", "an", "an", "the" and the like mentioned in this application do not denote a quantitative limitation, and may denote the singular or the plural. The terms "comprising", "comprising", "having" and any variations thereof referred to in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product or The apparatus is not limited to the steps or units listed, but may further include steps or units not listed, or may further include other steps or units inherent to the process, method, product or apparatus. Words like "connected," "connected," "coupled," and the like referred to in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "plurality" referred to in this application means greater than or equal to two. "And/or" describes the association relationship between associated objects, indicating that there can be three kinds of relationships. For example, "A and/or B" can mean that A exists alone, A and B exist at the same time, and B exists alone. The terms "first", "second", "third", etc. involved in this application are only to distinguish similar objects, and do not represent a specific order for the objects.
本实施例提供的方法实施例可以在终端、计算机或者类似的运算装置中执行。以运行在终端上为例,图1是本申请实施例的虚拟机的网络适配器配置方法的终端的硬件结构框图。如图1所示,终端可以包括一个或多个(图1中仅示出一个)处理器102(处理器102可以包括但不限于微处理器MCU或可编程逻辑器件FPGA等的处理装置)和用于存储数据的存储器104,可选地,上述终端还可以包括用于通信功能的传输设备106以及输入输出设备108。本领域普通技术人员可以理解,图1所示的结构仅为示意,其并不对上述终端的结构造成限定。例如,终端还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。The method embodiments provided in this embodiment may be executed in a terminal, a computer or a similar computing device. Taking running on a terminal as an example, FIG. 1 is a hardware structural block diagram of a terminal according to a method for configuring a network adapter of a virtual machine according to an embodiment of the present application. As shown in FIG. 1 , the terminal may include one or more (only one is shown in FIG. 1 ) processor 102 (the
存储器104可用于存储计算机程序,例如,应用软件的软件程序以及模块,如本申请实施例中的虚拟机的网络适配器配置方法对应的计算机程序,处理器102通过运行存储在存储器104内的计算机程序,从而执行各种功能应用以及数据处理,即实现上述的方法。存储器104可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器104可进一步包括相对于处理器102远程设置的存储器,这些远程存储器可以通过网络连接至终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The
传输设备106用于经由一个网络接收或者发送数据。上述的网络具体实例可包括终端的通信供应商提供的无线网络。在一个实例中,传输设备106包括一个网络适配器(Network Interface Controller,简称为NIC),其可通过基站与其他网络设备相连从而可与互联网进行通讯。在一个实例中,传输设备106可以为射频(Radio Frequency,简称为RF)模块,其用于通过无线方式与互联网进行通讯。
本实施例提供了一种虚拟机的网络适配器配置方法。图2是根据本申请实施例的虚拟机的网络适配器配置方法的流程图,如图2所示,该流程包括如下步骤:This embodiment provides a method for configuring a network adapter of a virtual machine. FIG. 2 is a flowchart of a method for configuring a network adapter of a virtual machine according to an embodiment of the present application. As shown in FIG. 2 , the flowchart includes the following steps:
步骤S201,在虚拟机在启动后,检测虚拟机的网络适配器的通信状态。Step S201, after the virtual machine is started, the communication state of the network adapter of the virtual machine is detected.
本实施例中,虚拟机可以是Linux或Windows系统,也可以是基于虚拟机技术的其他操作系统。In this embodiment, the virtual machine may be a Linux or Windows system, or may be other operating systems based on the virtual machine technology.
步骤S202,在检测到虚拟机的网络适配器的通信状态异常的情况下,获取虚拟机所在的真实主机的网络配置信息。Step S202, in the case of detecting that the communication state of the network adapter of the virtual machine is abnormal, obtain the network configuration information of the real host where the virtual machine is located.
步骤S203,根据网络配置信息配置网络适配器的配置文件。Step S203, configure the configuration file of the network adapter according to the network configuration information.
步骤S204,重启网络适配器对应的服务,以使网络适配器的配置文件生效。Step S204: Restart the service corresponding to the network adapter to make the configuration file of the network adapter take effect.
在本实施例中,重新启动网络适配器对应的服务的作用在于,部分程序的安装需要改写计算机系统注册表,再重新启动网络适配器对应的服务后能够正常使用。同时,在脚本运行的过程中网络IP地址、子网掩码等各项网络参数会发生变化,重新启动网络适配器对应的服务能够重新获取此类参数信息。其中,重启网络适配器对应的服务的功能是通过一定的计算机指令实现的。上述计算机指令包括但不限于network restart指令、root指令等能够使计算机系统网络适配器对应的服务重新启动的程序指令。In this embodiment, the function of restarting the service corresponding to the network adapter is that the installation of some programs needs to rewrite the computer system registry, and the service corresponding to the network adapter can be used normally after restarting. At the same time, various network parameters such as the network IP address and subnet mask will change during the running of the script. Restarting the service corresponding to the network adapter can obtain such parameter information again. The function of restarting the service corresponding to the network adapter is realized through certain computer instructions. The above-mentioned computer instructions include, but are not limited to, network restart instructions, root instructions, and other program instructions capable of restarting the service corresponding to the network adapter of the computer system.
在其中一些实施例中。真实主机的网络配置信息至少包括:网络适配器的物理地址、网络适配器名称、网络适配器类型、网络适配器对应的服务的启动配置信息。in some of these embodiments. The network configuration information of the real host at least includes: the physical address of the network adapter, the name of the network adapter, the type of the network adapter, and the startup configuration information of the service corresponding to the network adapter.
在其中一些实施例中,步骤S202包括:在检测到虚拟机的网络适配器的通信状态异常的情况下,通过执行ip addr命令获取真实主机的网络配置信息。在本实施例中,脚本通过ip addr命令获取真实主机的网络配置信息,便于在后续步骤中将真实主机的网络配置信息与当前的网络配置信息进行对比,判断二者是否一致,根据判断情况作出不同的处理,使虚拟机的网络配置信息始终正确,保证虚拟机的正常通信。In some of the embodiments, step S202 includes: in the case of detecting that the communication state of the network adapter of the virtual machine is abnormal, obtaining the network configuration information of the real host by executing the ip addr command. In this embodiment, the script obtains the network configuration information of the real host through the ip addr command, which is convenient to compare the network configuration information of the real host with the current network configuration information in the subsequent steps to determine whether the two are consistent, and make a decision according to the judgment situation. Different processing ensures that the network configuration information of the virtual machine is always correct and ensures the normal communication of the virtual machine.
在其中一些实施例中,虚拟机(Virtual Machine)是指通过软件模拟的具有完整硬件系统功能的、运行在一个完全隔离环境中的完整计算机系统。网络是用物理链路将各个孤立的工作站或主机相连在一起,组成数据链路,从而达到资源共享和通信的目的。通信是人与人之间通过某种媒体进行的信息交流与传递。网络通信是通过网络将各个孤立的设备进行连接,通过信息交换实现人与人,人与计算机,计算机与计算机之间的通信。虚拟系统通过生成现有操作系统的全新虚拟镜像,它具有真实操作系统完全一样的功能,进入虚拟系统后,所有操作都是在这个全新的独立的虚拟系统里面进行,可以独立安装运行软件,保存数据,拥有自己的独立桌面,不会对真正的系统产生任何影响,而且具有能够在现有系统与虚拟镜像之间灵活切换的一类操作系统。In some of the embodiments, a virtual machine (Virtual Machine) refers to a complete computer system simulated by software with complete hardware system functions and running in a completely isolated environment. The network uses physical links to connect isolated workstations or hosts together to form data links, so as to achieve the purpose of resource sharing and communication. Communication is the exchange and transmission of information between people through a certain medium. Network communication is to connect various isolated devices through the network, and realize the communication between people, people and computers, and computers and computers through information exchange. By generating a new virtual image of the existing operating system, the virtual system has exactly the same functions as the real operating system. After entering the virtual system, all operations are carried out in this new independent virtual system, which can independently install and run software, save data, has its own independent desktop, does not have any impact on the real system, and has a class of operating systems that can flexibly switch between existing systems and virtual images.
在其中一个实施例中,脚本(Script),是使用一种特定的描述性语言,依据一定的格式编写的可执行文件。本申请在上述步骤之前在虚拟机系统中导入编写好的可执行脚本文件,在系统启动时同步开始执行上述的预先导入的可执行脚本文件。此脚本文件为本申请的重点内容,具体包含:获取正确的网络适配器的配置文件,再者比对现系统的配置内容,会有两种情况,其一为网络适配器的配置文件不存在,那么系统按照脚本编写的程序会自动创建对应的网络适配器的配置文件并编辑其内容,将真实主机的网络配置信息编辑到这其中;其二为已存在对应的网络适配器的配置文件,则系统会根据脚本的程序内容调整网络适配器的配置文件的内容,将获取到的真实主机的网络配置信息写入其具体的内容中。In one of the embodiments, a script is an executable file written according to a certain format using a specific descriptive language. The present application imports the prepared executable script file into the virtual machine system before the above steps, and starts to execute the above-mentioned pre-imported executable script file synchronously when the system is started. This script file is the key content of the application, which specifically includes: obtaining the correct configuration file of the network adapter, and comparing the configuration content of the current system, there will be two situations, one is that the configuration file of the network adapter does not exist, then The program written by the system according to the script will automatically create the configuration file of the corresponding network adapter and edit its content, and edit the network configuration information of the real host into it; the second is that the configuration file of the corresponding network adapter already exists, the system will The program content of the script adjusts the content of the configuration file of the network adapter, and writes the acquired network configuration information of the real host into its specific content.
在虚拟机的使用过程中,当虚拟系统导入到虚拟环境之后再次启动此虚拟机,则会出现无法正常与外界通信的问题存在,此问题出现的主要根源有两大类,其一就是其虚拟机缺少都有的网络适配器的配置文件从而导致无法正常通讯;其二就是网络适配器的配置文件存在但是其网络配置信息存在异常,异常内容包含网卡名称不一致、mac地址不一致、其他网络配置不一致。如果将虚拟系统保持正常通讯即需要增加网络适配器的配置文件或者修改网络适配器的配置文件至正常通讯需求内容即可正常通讯。通过上述步骤,在系统中预先导入编辑好的脚本文件,此脚本文件能够检测系统启动后的网络适配器的配置文件状态并对异常或损坏的网络适配器的配置文件进行修复,保证系统的正常通讯。In the process of using the virtual machine, when the virtual system is imported into the virtual environment and the virtual machine is started again, there will be a problem of not being able to communicate with the outside world normally. There are two main causes of this problem. One is its virtual The computer lacks the configuration files of all network adapters, which leads to the failure of normal communication; the second is that the configuration files of the network adapters exist, but the network configuration information is abnormal. The abnormal content includes inconsistent network card names, inconsistent mac addresses, and other network configurations. If the virtual system maintains normal communication, the configuration file of the network adapter needs to be added or the configuration file of the network adapter needs to be modified to the content required for normal communication, and then the communication can be performed normally. Through the above steps, the edited script file is imported into the system in advance. This script file can detect the status of the configuration file of the network adapter after the system is started and repair the configuration file of the abnormal or damaged network adapter to ensure the normal communication of the system.
通过上述步骤,能够实现在系统启动的过程中同步对网络适配器的配置文件进行自动配置,在重新启动网络适配器对应的服务后能够正常通信,不会占用虚拟系统的资源,不会延长虚拟系统的启动时间,有效避免了针对网络服务基础较差的运维人员需要花费大量的时间去咨询排查的问题。Through the above steps, the configuration file of the network adapter can be automatically configured synchronously during the system startup process. After restarting the service corresponding to the network adapter, the network adapter can communicate normally without occupying the resources of the virtual system and prolonging the service life of the virtual system. The startup time effectively avoids the need for operation and maintenance personnel with poor network service foundation to spend a lot of time consulting and troubleshooting.
下面通过优选实施例对本申请实施例中的脚本文件进行描述和说明。The script files in the embodiments of the present application will be described and illustrated below through preferred embodiments.
优选实施例一Preferred Embodiment 1
在本优选实施例中提供了一种虚拟机的网络适配器配置方法。图3是根据本申请优选实施例一的虚拟机的网络适配器配置方法的流程图,如图3所示,该流程包括如下步骤:In this preferred embodiment, a method for configuring a network adapter of a virtual machine is provided. FIG. 3 is a flowchart of a method for configuring a network adapter of a virtual machine according to a preferred embodiment 1 of the present application. As shown in FIG. 3 , the flowchart includes the following steps:
步骤S301,生成脚本程序。Step S301, generating a script program.
步骤S302,将脚本程序写入到虚拟机中,并设置在虚拟机启动时运行脚本程序。In step S302, the script program is written into the virtual machine, and the script program is set to run when the virtual machine is started.
步骤S303,在虚拟机在启动后,检测虚拟机的网络适配器的通信状态。Step S303, after the virtual machine is started, the communication state of the network adapter of the virtual machine is detected.
本实施例中,虚拟机可以是Linux或Windows系统,也可以是基于虚拟机技术的其他操作系统。In this embodiment, the virtual machine may be a Linux or Windows system, or may be other operating systems based on the virtual machine technology.
步骤S304,在检测到虚拟机的网络适配器的通信状态异常的情况下,获取虚拟机所在的真实主机的网络配置信息。Step S304, in the case of detecting that the communication state of the network adapter of the virtual machine is abnormal, obtain the network configuration information of the real host where the virtual machine is located.
步骤S305,根据网络配置信息配置网络适配器的配置文件。Step S305, configure the configuration file of the network adapter according to the network configuration information.
步骤S306,重启网络适配器对应的服务,以使网络适配器的配置文件生效。Step S306, restart the service corresponding to the network adapter, so that the configuration file of the network adapter takes effect.
通过上述步骤,预先编辑导入系统的脚本文件首先检测网络适配器的配置文件是否存在于计算机系统中,之后将存在于系统的网络适配器的配置文件和获取的网络适配器的配置文件进行比对,判断两份网络适配器的配置文件的配置信息。当两份网络适配器的配置文件的配置信息不一致时,则先将存在于系统中的网络适配器的配置文件中的配置信息删除,之后将正确的网络适配器对应的服务信息同步更新至现有的网络适配器的配置文件之中,使得网络适配器的配置文件的配置信息保持正确。Through the above steps, pre-editing the script file imported into the system firstly detects whether the configuration file of the network adapter exists in the computer system, and then compares the configuration file of the network adapter existing in the system with the obtained configuration file of the network adapter, and judges the two Backup configuration information for the network adapter's configuration file. When the configuration information of the two network adapter configuration files is inconsistent, first delete the configuration information in the configuration file of the network adapter in the system, and then update the service information corresponding to the correct network adapter to the existing network synchronously. In the configuration file of the adapter, the configuration information of the configuration file of the network adapter is kept correct.
通过上述脚本文件的运行,脚本通过运行其中的计算机程序能够自动获取虚拟系统中的网络适配器的配置文件信息和正确的网络适配器对应的服务信息,根据虚拟系统中的网络适配器的配置文件信息和正确的网络适配器对应的服务信息判断系统中脚本文件的正确性。Through the running of the above script file, the script can automatically obtain the configuration file information of the network adapter in the virtual system and the service information corresponding to the correct network adapter by running the computer program therein. The service information corresponding to the network adapter determines the correctness of the script file in the system.
优选实施例二Preferred Embodiment 2
图4是根据本申请优选实施例二的虚拟机的网络适配器配置方法的流程图,如图4所示,该流程包括如下步骤:FIG. 4 is a flowchart of a method for configuring a network adapter of a virtual machine according to the second preferred embodiment of the present application. As shown in FIG. 4 , the flowchart includes the following steps:
步骤S401,生成脚本程序。Step S401, generating a script program.
步骤S402,将脚本程序写入到虚拟机中,并设置在虚拟机启动时运行脚本程序。In step S402, the script program is written into the virtual machine, and the script program is set to run when the virtual machine is started.
步骤S403,在虚拟机在启动后,检测虚拟机的网络适配器的通信状态。Step S403, after the virtual machine is started, the communication state of the network adapter of the virtual machine is detected.
本实施例中,虚拟机可以是Linux或Windows系统,也可以是基于虚拟机技术的其他操作系统。In this embodiment, the virtual machine may be a Linux or Windows system, or may be other operating systems based on the virtual machine technology.
步骤S404,在检测到虚拟机的网络适配器的通信状态异常的情况下,获取虚拟机所在的真实主机的网络配置信息。Step S404, in the case of detecting that the communication state of the network adapter of the virtual machine is abnormal, obtain the network configuration information of the real host where the virtual machine is located.
步骤S405,判断网络适配器的配置文件是否存在。Step S405, it is judged whether the configuration file of the network adapter exists.
步骤S406,在判断到网络适配器的配置文件不存在的情况下,生成配置文件,并将配置信息写入到配置文件中。Step S406, when it is determined that the configuration file of the network adapter does not exist, a configuration file is generated, and the configuration information is written into the configuration file.
在本实施例中,如果比对结果为网络适配器的配置文件不存在,则生成网络适配器的配置文件,更新网络适配器的配置文件的内容,具体步骤为:具体步骤为:在系统中查看获取真实网络适配器的配置文件的内容;生成网络适配器的配置文件至系统的/etc/sysconfig/network-scripts目录下;编辑生成网络适配器的配置文件,将真实网络适配器的配置文件的内容更新到生成网络适配器的配置文件;保存之后退出编辑模式。其中,系统的/etc/sysconfig/network-scripts目录为虚拟系统存放网络适配器的配置文件的文件目录,系统根据脚本文件中的计算机程序指定的上述文件目录创建新的网络适配器的配置文件,保证网络适配器的配置文件的网络适配器对应的服务信息正确,保证了虚拟系统能够正常通信。In this embodiment, if the comparison result is that the configuration file of the network adapter does not exist, the configuration file of the network adapter is generated, and the content of the configuration file of the network adapter is updated. The content of the configuration file of the network adapter; generate the configuration file of the network adapter to the /etc/sysconfig/network-scripts directory of the system; edit the configuration file of the generated network adapter, and update the content of the configuration file of the real network adapter to the generated network adapter configuration file; exit edit mode after saving. The /etc/sysconfig/network-scripts directory of the system is the file directory where the virtual system stores the configuration file of the network adapter. The system creates a new network adapter configuration file according to the above-mentioned file directory specified by the computer program in the script file to ensure that the network The service information corresponding to the network adapter in the adapter configuration file is correct, which ensures that the virtual system can communicate normally.
步骤S407,在判断到网络适配器的配置文件已存在的情况下,根据配置信息更新配置文件。Step S407, when it is determined that the configuration file of the network adapter already exists, the configuration file is updated according to the configuration information.
在本实施例中,如果比对结果为网络适配器的配置文件已存在,则根据配置信息更新配置文件,具体步骤为:在系统中查看获取真实网络适配器的配置文件的内容;将真实网络适配器的配置文件的内容同步更新到网络适配器的配置文件中,其中,同步更新时需要将网络适配器的配置文件中原有的网络适配器的配置文件的内容删除,再更新真实网络适配器的配置文件的内容;保存并退出编辑模式。通过此步骤,虚拟系统在确定网络适配器的配置文件存在的情况下,将先前获取的真实主机的网络配置信息更新到网络适配器的配置文件,保证了网络适配器的配置文件的正确性。In this embodiment, if the comparison result is that the configuration file of the network adapter already exists, the configuration file is updated according to the configuration information. The specific steps are: checking the content of the configuration file of the real network adapter in the system; The content of the configuration file is synchronously updated to the configuration file of the network adapter, wherein the content of the original configuration file of the network adapter in the configuration file of the network adapter needs to be deleted during the synchronization update, and then the content of the configuration file of the real network adapter is updated; save and exit edit mode. Through this step, the virtual system updates the previously acquired network configuration information of the real host to the configuration file of the network adapter when it is determined that the configuration file of the network adapter exists, thereby ensuring the correctness of the configuration file of the network adapter.
在本实施例中,当对比结果为网络适配器的配置文件存在于系统中,说明在虚拟系统启动过程中网络适配器的配置文件可能已经损坏,系统根据脚本的计算机程序会根据先前步骤获取到的配置信息重新修改编辑网络适配器的配置文件中的配置信息,保障系统网络适配器的配置文件中的配置信息正确。In this embodiment, when the comparison result is that the configuration file of the network adapter exists in the system, it means that the configuration file of the network adapter may have been damaged during the startup process of the virtual system, and the computer program of the system according to the script will obtain the configuration according to the previous steps. Information Re-modification Edit the configuration information in the configuration file of the network adapter to ensure that the configuration information in the configuration file of the system network adapter is correct.
步骤S408,重启网络适配器对应的服务,以使网络适配器的配置文件生效。Step S408: Restart the service corresponding to the network adapter to make the configuration file of the network adapter take effect.
在本实施例中,当对比结果为网络适配器的配置文件不存在于系统中,说明在虚拟系统启动过程中网络适配器的配置文件已经丢失,系统根据脚本的计算机程序会在指定的路径下重新创建一个新的空白的网络适配器的配置文件。在创建网络适配器的配置文件完成之后,系统则会根据脚本的计算机程序为新的空白的网络适配器的配置文件更新先前获取的配置信息。In this embodiment, when the comparison result is that the configuration file of the network adapter does not exist in the system, it means that the configuration file of the network adapter has been lost during the startup of the virtual system, and the system will recreate the computer program according to the script under the specified path. A new blank network adapter configuration file. After the configuration file for the network adapter is created, the system updates the previously acquired configuration information for the new blank network adapter configuration file according to the scripted computer program.
在其中一个实施例中,判断网络适配器的配置文件是否存在包括:在虚拟机的系统中查询/etc/sysconfig/network-scripts路径下是否存在配置文件;在/etc/sysconfig/network-scripts路径下不存在配置文件的情况下,确定网络适配器的配置文件不存在;否则确定网络适配器的配置文件存在。在本实施例中,采用了上述方法来判断网络适配器的配置文件是否存在,其作用在于检测当前虚拟机的网络适配器状态,便于在后续步骤中根据当前虚拟机的网络适配器状态来配置网络适配器的配置文件,保证虚拟机的正常通信功能。In one embodiment, determining whether the configuration file of the network adapter exists includes: querying the system of the virtual machine whether the configuration file exists under the path /etc/sysconfig/network-scripts; under the path /etc/sysconfig/network-scripts If the configuration file does not exist, it is determined that the configuration file of the network adapter does not exist; otherwise, it is determined that the configuration file of the network adapter exists. In this embodiment, the above method is used to determine whether the configuration file of the network adapter exists, and its function is to detect the network adapter status of the current virtual machine, so as to facilitate the configuration of the network adapter according to the network adapter status of the current virtual machine in subsequent steps. The configuration file ensures the normal communication function of the virtual machine.
本实施例还提供了一种虚拟机的网络适配器配置装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”、“单元”、“子单元”等可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。This embodiment also provides an apparatus for configuring a network adapter of a virtual machine, the apparatus is used to implement the foregoing embodiments and preferred implementations, and what has been described will not be repeated. As used below, the terms "module," "unit," "subunit," etc. may be a combination of software and/or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, implementations in hardware, or a combination of software and hardware, are also possible and contemplated.
图5是根据本申请实施例的虚拟机的网络适配器配置装置结构框图。如图5所示,该装置包括:FIG. 5 is a structural block diagram of an apparatus for configuring a network adapter of a virtual machine according to an embodiment of the present application. As shown in Figure 5, the device includes:
检测模块51,用于在虚拟机在启动后,检测虚拟机的网络适配器的通信状态;The
获取模块52,耦接至检测模块51,用于在检测到虚拟机的网络适配器的通信状态异常的情况下,获取虚拟机所在的真实主机的网络配置信息;an
配置模块53,耦接至获取模块52,用于根据网络配置信息配置网络适配器的配置文件;The
重启模块54,耦接至配置模块53,用于重启网络适配器对应的服务,以使网络适配器的配置文件生效。The
在其中一些实施例中,配置模块包括:判断单元,用于判断所述网络适配器的配置文件是否存在;写入单元,耦接至判断单元,用于在判断到所述网络适配器的配置文件不存在的情况下,生成所述配置文件,并将所述配置信息写入到所述配置文件中。In some of the embodiments, the configuration module includes: a judging unit for judging whether a configuration file of the network adapter exists; a writing unit, coupled to the judging unit, for judging that the configuration file of the network adapter does not exist If the configuration file exists, the configuration file is generated, and the configuration information is written into the configuration file.
在其中一个实施例中,配置模块还包括:更新单元,耦接至判断单元,用于在判断到所述网络适配器的配置文件已存在的情况下,根据所述配置信息更新所述配置文件。In one embodiment, the configuration module further includes: an update unit, coupled to the determination unit, configured to update the configuration file according to the configuration information when it is determined that the configuration file of the network adapter already exists.
在其中一个实施例中,判断单元包括:查询子单元,用于在所述虚拟机的系统中查询/etc/sysconfig/network-scripts路径下是否存在所述配置文件;确定子单元,耦接至查询子单元,用于在/etc/sysconfig/network-scripts路径下不存在所述配置文件的情况下,确定所述网络适配器的配置文件不存在;否则确定所述网络适配器的配置文件存在。In one embodiment, the judging unit includes: a querying subunit, configured to query whether the configuration file exists in the /etc/sysconfig/network-scripts path in the system of the virtual machine; a determining subunit, coupled to The query subunit is used to determine that the configuration file of the network adapter does not exist if the configuration file does not exist in the path /etc/sysconfig/network-scripts; otherwise, determine that the configuration file of the network adapter exists.
在其中一个实施例中,所述真实主机的网络配置信息包括以下至少之一:网络适配器的物理地址、网络适配器名称、网络适配器类型、网络适配器对应的服务的启动配置信息。In one embodiment, the network configuration information of the real host includes at least one of the following: the physical address of the network adapter, the name of the network adapter, the type of the network adapter, and the startup configuration information of the service corresponding to the network adapter.
在其中一个实施例中,获取模块,用于在检测到所述虚拟机的网络适配器的通信状态异常的情况下,通过执行ip addr命令获取所述真实主机的网络配置信息。In one of the embodiments, the obtaining module is configured to obtain the network configuration information of the real host by executing the ip addr command when detecting that the communication state of the network adapter of the virtual machine is abnormal.
需要说明的是,上述各个模块可以是功能模块也可以是程序模块,既可以通过软件来实现,也可以通过硬件来实现。对于通过硬件来实现的模块而言,上述各个模块可以位于同一处理器中;或者上述各个模块还可以按照任意组合的形式分别位于不同的处理器中。It should be noted that each of the above modules may be functional modules or program modules, and may be implemented by software or hardware. For the modules implemented by hardware, the above-mentioned modules may be located in the same processor; or the above-mentioned modules may also be located in different processors in any combination.
本实施例还提供了一种虚拟机的网络适配器配置装置,包括存储器和处理器,其特征在于,存储器中存储有计算机程序,处理器被设置为运行计算机程序以上述步骤说明中任一项虚拟机的网络适配器配置方法。This embodiment also provides a device for configuring a network adapter of a virtual machine, including a memory and a processor, characterized in that, a computer program is stored in the memory, and the processor is configured to run the computer program to virtualize any one of the above step descriptions. how to configure the machine's network adapter.
可选地,上述电子装置还可以包括传输设备以及输入输出设备,其中,该传输设备和上述处理器连接,该输入输出设备和上述处理器连接。Optionally, the above-mentioned electronic device may further include a transmission device and an input-output device, wherein the transmission device is connected to the above-mentioned processor, and the input-output device is connected to the above-mentioned processor.
可选地,在本实施例中,上述处理器可以被设置为通过计算机程序执行以下步骤:Optionally, in this embodiment, the above-mentioned processor may be configured to execute the following steps through a computer program:
S1,在虚拟机在启动后,检测虚拟机的网络适配器的通信状态。S1, after the virtual machine is started, the communication state of the network adapter of the virtual machine is detected.
S2,在检测到虚拟机的网络适配器的通信状态异常的情况下,获取虚拟机所在的真实主机的网络配置信息。S2, in the case of detecting that the communication state of the network adapter of the virtual machine is abnormal, obtain the network configuration information of the real host where the virtual machine is located.
S3,根据网络配置信息配置网络适配器的配置文件。S3, configure the configuration file of the network adapter according to the network configuration information.
S4,重启网络适配器对应的服务,以使网络适配器的配置文件生效。S4, restart the service corresponding to the network adapter, so that the configuration file of the network adapter takes effect.
需要说明的是,本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。It should be noted that, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments and optional implementation manners, and details are not described herein again in this embodiment.
本实施例还提供了一种虚拟机的网络适配器配置的存储介质,其特征在于,存储介质中存储有计算机程序,其中,计算机程序被设置为运行时执行以上步骤中任一项虚拟机的网络适配器配置方法。This embodiment also provides a storage medium configured by a network adapter of a virtual machine, characterized in that the storage medium stores a computer program, wherein the computer program is set to execute any one of the above steps when running the network of the virtual machine Adapter configuration method.
相较于已知技术,本申请采取预先向系统中导入脚本的方式实现对虚拟机的网络适配器配置,同时本申请能够在不需要专业技术人员操作的情况下生成缺失的网络适配器的配置文件,修复损坏的网络适配器的配置文件,并且在完成异常网络适配器的配置文件修复后,可以由人工设定或者第三方程序设定相应的IP地址和通讯参数,具有较大的灵活性,使得不具备互联网和计算机领域专业知识的用户也能够自行完成对虚拟机的网络适配器配置异常问题的解决,同时设置用户所在地网络IP地址,保证系统能够实现正常的通讯功能。Compared with the known technology, the present application adopts the method of importing a script into the system in advance to realize the configuration of the network adapter of the virtual machine, and at the same time, the present application can generate the configuration file of the missing network adapter without the operation of professional technicians, Repair the configuration file of the damaged network adapter, and after completing the repair of the configuration file of the abnormal network adapter, the corresponding IP address and communication parameters can be set manually or by a third-party program, which has greater flexibility, making it impossible to have Users with professional knowledge in the Internet and computer fields can also solve the problem of abnormal configuration of the virtual machine's network adapter, and set the network IP address of the user's location to ensure that the system can achieve normal communication functions.
综上,通过本申请提供的上述实施例或者优选实施方式,有如下有益效果:To sum up, the above-mentioned embodiments or preferred embodiments provided by this application have the following beneficial effects:
1、在本申请实施例中在虚拟系统中预先导入了脚本文件,脚本文件自动随着虚拟系统的启动而运行。因此脚本文件的运行不需要人工操作,可以直接自动运行脚本文件中的计算机程序代码,可以给运行维护人员带来大量的工作效益,节约了技术人员和运行维护人员大量时间。1. In the embodiment of the present application, a script file is pre-imported into the virtual system, and the script file automatically runs with the startup of the virtual system. Therefore, the operation of the script file does not require manual operation, and the computer program code in the script file can be directly and automatically run, which can bring a lot of work benefits to the operation and maintenance personnel, and save a lot of time for the technicians and the operation and maintenance personnel.
2、在本申请实施例中只需要对计算机进行脚本导入,不需要对服务器进行更改,减少人力资源的浪费,及减少更改的范围。2. In the embodiment of the present application, only the script needs to be imported into the computer, and the server does not need to be changed, which reduces the waste of human resources and reduces the scope of the change.
本领域的技术人员应该明白,以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。Those skilled in the art should understand that the technical features of the above embodiments can be combined arbitrarily. In order to simplify the description, all possible combinations of the technical features in the above embodiments are not described. However, as long as these technical features There is no contradiction in the combination of the above, and they should be considered to be within the scope of the description in this specification.
以上实施例仅表达了本申请的一种实施方式,其描述较为具体和详细,但并不能因此而理解为对申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above embodiment only represents an embodiment of the present application, and its description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the patent application. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the patent of the present application shall be subject to the appended claims.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010825980.4A CN112099902A (en) | 2020-08-17 | 2020-08-17 | Network adapter configuration method and device of virtual machine, electronic device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010825980.4A CN112099902A (en) | 2020-08-17 | 2020-08-17 | Network adapter configuration method and device of virtual machine, electronic device and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112099902A true CN112099902A (en) | 2020-12-18 |
Family
ID=73754478
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010825980.4A Pending CN112099902A (en) | 2020-08-17 | 2020-08-17 | Network adapter configuration method and device of virtual machine, electronic device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112099902A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113839815A (en) * | 2021-09-18 | 2021-12-24 | 浪潮电子信息产业股份有限公司 | A server network port configuration method, device, server and readable storage medium |
CN115150298A (en) * | 2021-03-31 | 2022-10-04 | 北京金山云网络技术有限公司 | Virtual gateway testing method and device, storage medium and electronic equipment |
WO2025055274A1 (en) * | 2023-09-15 | 2025-03-20 | 超聚变数字技术有限公司 | Management configuration method, computing device and server |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9286093B1 (en) * | 2013-05-10 | 2016-03-15 | Ca, Inc. | Setting up network adaptors in a virtual machine |
CN106411575A (en) * | 2016-09-07 | 2017-02-15 | 华为技术有限公司 | Network configuration check method and related equipment under cloud environment |
CN106909443A (en) * | 2017-02-28 | 2017-06-30 | 郑州云海信息技术有限公司 | The collocation method and device of a kind of virtual machine |
CN107370622A (en) * | 2017-07-14 | 2017-11-21 | 郑州云海信息技术有限公司 | A kind of virtual machine multiplexing host MAC and IP method and system |
CN110321197A (en) * | 2019-05-17 | 2019-10-11 | 广东睿江云计算股份有限公司 | A kind of Microsoft Loopback Adapter management method based on KVM |
US20190349294A1 (en) * | 2018-05-11 | 2019-11-14 | Microsoft Technology Licensing, Llc | Maintaining apparent connectivity during virtual switch servicing |
CN110737544A (en) * | 2019-09-20 | 2020-01-31 | 苏州浪潮智能科技有限公司 | System for automatically rolling back openstack virtual machine configuration change failures |
CN111427662A (en) * | 2020-03-23 | 2020-07-17 | 深信服科技股份有限公司 | Method for allocating IP addresses of virtual machines, terminal equipment and DHCP server |
CN111459606A (en) * | 2020-03-03 | 2020-07-28 | 山东汇贸电子口岸有限公司 | Method for quickly creating virtual machine under virtualization and server |
-
2020
- 2020-08-17 CN CN202010825980.4A patent/CN112099902A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9286093B1 (en) * | 2013-05-10 | 2016-03-15 | Ca, Inc. | Setting up network adaptors in a virtual machine |
CN106411575A (en) * | 2016-09-07 | 2017-02-15 | 华为技术有限公司 | Network configuration check method and related equipment under cloud environment |
CN106909443A (en) * | 2017-02-28 | 2017-06-30 | 郑州云海信息技术有限公司 | The collocation method and device of a kind of virtual machine |
CN107370622A (en) * | 2017-07-14 | 2017-11-21 | 郑州云海信息技术有限公司 | A kind of virtual machine multiplexing host MAC and IP method and system |
US20190349294A1 (en) * | 2018-05-11 | 2019-11-14 | Microsoft Technology Licensing, Llc | Maintaining apparent connectivity during virtual switch servicing |
CN110321197A (en) * | 2019-05-17 | 2019-10-11 | 广东睿江云计算股份有限公司 | A kind of Microsoft Loopback Adapter management method based on KVM |
CN110737544A (en) * | 2019-09-20 | 2020-01-31 | 苏州浪潮智能科技有限公司 | System for automatically rolling back openstack virtual machine configuration change failures |
CN111459606A (en) * | 2020-03-03 | 2020-07-28 | 山东汇贸电子口岸有限公司 | Method for quickly creating virtual machine under virtualization and server |
CN111427662A (en) * | 2020-03-23 | 2020-07-17 | 深信服科技股份有限公司 | Method for allocating IP addresses of virtual machines, terminal equipment and DHCP server |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115150298A (en) * | 2021-03-31 | 2022-10-04 | 北京金山云网络技术有限公司 | Virtual gateway testing method and device, storage medium and electronic equipment |
CN115150298B (en) * | 2021-03-31 | 2023-11-03 | 北京金山云网络技术有限公司 | Virtual gateway testing method and device, storage medium and electronic equipment |
CN113839815A (en) * | 2021-09-18 | 2021-12-24 | 浪潮电子信息产业股份有限公司 | A server network port configuration method, device, server and readable storage medium |
CN113839815B (en) * | 2021-09-18 | 2024-11-01 | 浪潮电子信息产业股份有限公司 | Method and device for configuring server network port, server and readable storage medium |
WO2025055274A1 (en) * | 2023-09-15 | 2025-03-20 | 超聚变数字技术有限公司 | Management configuration method, computing device and server |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109951325B (en) | Method and device for checking network cable connection | |
WO2019184164A1 (en) | Method for automatically deploying kubernetes worker node, device, terminal apparatus, and readable storage medium | |
CN113452830B (en) | Batch control method of android cloud mobile phone, computer readable medium and electronic device | |
CN113419815B (en) | Method, system, equipment and medium for pre-starting operation environment installation | |
WO2018192478A1 (en) | Cloud management platform, virtual machine management method, system thereof | |
CN112099902A (en) | Network adapter configuration method and device of virtual machine, electronic device and storage medium | |
CN109039788B (en) | Port configuration method and device of network equipment and storage medium | |
WO2017185954A1 (en) | Method, host, and system for implementing usb device management | |
CN112527397A (en) | Method and device for modifying basic input output system options and computer equipment | |
US12113848B2 (en) | Method and system for implementing bare metal inspection process, device, and storage medium | |
US20190140897A1 (en) | Method for automatically initializing network device, remote server and network system using the same | |
CN108737499A (en) | server configuration method and device | |
US11863377B2 (en) | Discovery and configuration in computer networks | |
CN108989123A (en) | A kind of server configuration method and device | |
CN111339055A (en) | Big data cluster expansion method and device | |
CN114115955B (en) | Method, system, terminal and storage medium for upgrading FPGA firmware of server resource box | |
CN113238778B (en) | Method, system, equipment and medium for upgrading BIOS firmware | |
CN107172228A (en) | Change the method and apparatus and computer-readable recording medium of virtual machine IP address | |
CN111901395A (en) | Multi-cluster handover method and device | |
CN118585499A (en) | Energy storage management system update method, device and storage medium | |
US12175257B2 (en) | Provisioning DPU management operating systems using host and DPU boot coordination | |
CN107515760B (en) | OpenStack multi-node automatic installation method and system | |
CN116232842A (en) | A PXE-based portable system maintenance device and method | |
CN111277463B (en) | Method, system, terminal and storage medium for testing accuracy of gateway address acquisition by BMC | |
JP2005197793A (en) | Network address assigning apparatus, network address assigning method and network address assigning program |
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 |