Method for realizing PXE installation by combining VLAN (Virtual Local Area Network) technology

Through VLAN technology and DHCP relay, the IP address and boot file paths for the virtual machine are automatically obtained, which solves the cumbersome problem of manually configuring the operating system in the existing technology, and realizes an efficient PXE installation process.

CN119854111APending Publication Date: 2025-04-18MACROSAN TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411997949.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

In business scenarios facing a large number of servers or virtual machines, the prior art requires manual configuration of different operating systems for different servers or virtual machines, resulting in cumbersome and inefficient installation.

Method used

Using VLAN technology, through DHCP relay and mapping tables, it automatically obtains IP addresses and boot file paths for the virtual machine, realizing the PXE installation process without manual participation.

Benefits of technology

It realizes automated operating system installation, improves installation efficiency, reduces human resource consumption, and ensures that different virtual machines can install different operating systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119854111A_ABST
    Figure CN119854111A_ABST
Patent Text Reader

Abstract

The invention discloses a method for realizing PXE installation in combination with a VLAN technology. The method comprises the following steps: for a created virtual machine, acquiring an IP address of a VLAN gateway corresponding to the virtual machine from a preset mapping table according to a BIOS mode selected for the virtual machine and the type of an OS to be installed, and triggering a DHCP relay to send a unicast packet used for requesting the IP address of the virtual machine through the virtual machine. Then, a response message returned by the DHCP server is received through the DHCP relay, and the response message carries the IP address of the virtual machine, the first boot file path and the IP address of the TFTP server; and finishing installation through the virtual machine according to the response message.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the computer field, and in particular to a method for implementing PXE installation by combining VLAN technology. Background Art

[0002] When installing a virtual machine (i.e., installing an operating system), you can use the Preboot Execution Environment (PXE). PXE allows you to remotely boot a computer and load an operating system over a network. When facing business scenarios with a large number of servers or virtual machines, PXE provides an efficient, automated, and scalable solution that helps achieve the goal of automated operation and management. Among them, PXE provides a mechanism for booting a computer using a network interface, supports computers to download images from a remote server over the network, and thus supports the boot process of an operating system from the network.

[0003] As the Internet continues to grow, the number of servers and virtual machines has increased dramatically, which has brought great challenges to operation and maintenance. Since different servers or virtual machines need to install different operating systems, in the existing technology, different operating systems are generally configured manually for different servers or virtual machines, which is cumbersome.

[0004] Based on this, how to implement a method of PXE installation in combination with VLAN technology to automatically install different operating systems for different servers or virtual machines is an urgent problem to be solved. Summary of the invention

[0005] This specification provides a method for implementing PXE installation in combination with VLAN technology to partially solve the above problems existing in the prior art.

[0006] This manual adopts the following technical solutions:

[0007] This specification provides a method for implementing PXE installation by combining VLAN technology, including:

[0008] For the created virtual machine, according to the basic input and output system BIOS mode selected for the virtual machine and the type of operating system OS to be installed, the IP address of the VLAN gateway corresponding to the virtual machine is obtained from a preset mapping table;

[0009] Triggering a Dynamic Host Configuration Protocol DHCP relay through the virtual machine to send a unicast packet for requesting the IP address of the virtual machine; the DHCP relay is configured on the VLAN gateway; the unicast packet carries the IP address of the DHCP relay; the IP address of the DHCP relay is the IP address of the VLAN gateway;

[0010] Receiving, through the DHCP relay, a response message returned by the DHCP server, wherein the response message carries the IP address of the virtual machine, the first boot file path, and the IP address of a Trivial File Transfer Protocol (TFTP) server;

[0011] The installation is completed through the virtual machine according to the response message.

[0012] Optionally, create a virtual machine, including:

[0013] Obtain the configuration parameters of the virtual machine, including the name of the virtual machine, the size of the central processing unit (CPU), the memory size, the size of the cloud disk, the storage location, and the planned loading network;

[0014] The virtual machine is created according to the configuration parameters.

[0015] Optionally, triggering a Dynamic Host Configuration Protocol DHCP relay through the virtual machine to send a unicast packet for requesting the IP address of the virtual machine specifically includes:

[0016] Sending, through the virtual machine, a broadcast packet for requesting the IP address of the virtual machine;

[0017] The broadcast packet is received through the DHCP relay, and a unicast packet for requesting the IP address of the virtual machine is determined according to the broadcast packet, and the unicast packet is sent to the DHCP server.

[0018] Optionally, the IP address of the virtual machine is determined by the DHCP server according to the IP address of the DHCP relay carried in the unicast packet.

[0019] Optionally, the first boot file path is determined by the DHCP server according to the IP address of the DHCP relay carried in the unicast packet and the mapping table.

[0020] Optionally, completing the installation by the virtual machine according to the response message specifically includes:

[0021] Obtaining, by the virtual machine, a first boot file from the TFTP server according to the response message, wherein the first boot file includes boot menu configuration information and kernel loading parameters for guiding the virtual machine to start and load the OS kernel;

[0022] Obtaining, through the virtual machine, a determined second boot file from the TFTP server according to the first boot file, wherein the second boot file is used to guide the virtual machine to obtain a response file and to display configuration information of the OS in the virtual machine;

[0023] The response file is obtained from the TFTP server according to the second boot file through the virtual machine, and the installation is completed according to the response file and the image file of the OS obtained from the TFTP server.

[0024] Optionally, determining the second boot file specifically includes:

[0025] The BIOS mode, the OS type and the response file name corresponding to the virtual machine are obtained from the mapping table through the TFTP server, and the second boot file is determined according to the BIOS mode, the OS type and the response file name.

[0026] This specification provides a device for implementing PXE installation by combining VLAN technology, including:

[0027] An acquisition module is used to acquire, for a created virtual machine, an IP address of a VLAN gateway corresponding to the virtual machine from a preset mapping table according to a basic input and output system BIOS mode selected for the virtual machine and a type of an operating system OS to be installed;

[0028] A request module, configured to trigger a Dynamic Host Configuration Protocol DHCP relay through the virtual machine to send a unicast packet for requesting the IP address of the virtual machine; the DHCP relay is configured on the VLAN gateway; the unicast packet carries the IP address of the DHCP relay; the IP address of the DHCP relay is the IP address of the VLAN gateway;

[0029] A receiving module, configured to receive a response message returned by the DHCP server through the DHCP relay, wherein the response message carries the IP address of the virtual machine, the first boot file path, and the IP address of a Trivial File Transfer Protocol TFTP server;

[0030] The installation module is used to complete the installation through the virtual machine according to the response message.

[0031] This specification provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the method for implementing PXE installation in combination with VLAN technology is implemented.

[0032] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the method for implementing PXE installation in combination with VLAN technology is implemented.

[0033] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects:

[0034] In the method for implementing PXE installation in combination with VLAN technology provided in this specification, for the created virtual machine, according to the BIOS mode selected for the virtual machine and the type of OS to be installed, the IP address of the VLAN gateway corresponding to the virtual machine is obtained from the preset mapping table, and the DHCP relay is triggered by the virtual machine to send a unicast packet for requesting the IP address of the virtual machine. Then, the response message returned by the DHCP server is received through the DHCP relay, wherein the response message carries the IP address of the virtual machine, the first boot file path, and the IP address of the TFTP server. The installation is completed through the virtual machine according to the response message.

[0035] It can be seen from the above method that in the method for implementing PXE installation in combination with VLAN technology provided in this specification, first, according to the BIOS mode selected for the virtual machine and the type of OS to be installed, the IP address of the VLAN gateway corresponding to the virtual machine can be directly obtained from the preset mapping table. In addition, the first boot file path can be determined according to the preset mapping table, and the first boot file path does not need to be manually configured, thus avoiding a tedious configuration process. The entire installation process does not require manual participation, and the degree of automation is high. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:

[0037] Figure 1 A flowchart of a method for implementing PXE installation in combination with VLAN technology provided in this specification;

[0038] Figure 2 A schematic diagram of a mapping table provided in this specification;

[0039] Figure 3 A schematic diagram of the format of a configuration file provided for this application;

[0040] Figure 4A , 4B A schematic diagram of a format of a second boot file provided in this specification;

[0041] Figure 5 A schematic diagram of a device for implementing PXE installation in combination with VLAN technology provided in this specification;

[0042] Figure 6 A method corresponding to the Figure 1Schematic diagram of electronic equipment. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.

[0044] Preboot Execution Environment (PXE) is a computer network protocol, technology, and framework that allows a computer to boot an operating system over a network without a local storage device. PXE is a network boot technology developed by Intel that allows a computer to boot an operating system over a network without a local storage device. PXE works in Client / Server mode, allowing a client to download a boot image from a remote server over the network and load an operating system.

[0045] As a way to quickly install an operating system (OS), PXE has a wide range of application scenarios, including diskless workstations, server deployment, system recovery, and virtualization environments. It can greatly simplify the complexity of system management and maintenance, and can easily achieve large-scale network boot and operating system deployment.

[0046] Among them, PXE is divided into client and server.

[0047] The PXE client is a PXE-enabled computer. When the computer starts, if PXE is enabled, the network card will try to boot the operating system through the network. The PXE client is in the read-only memory (ROM) of the network card. When the computer boots up, the Basic Input / Output System (BIOS) calls the PXE client into the memory for execution. The PXE client downloads the boot file placed in the PXE server through the network to the local computer for execution.

[0048] The PXE server can be considered as a PXE server, which provides boot files and related services. It usually includes the following components:

[0049] 1. Dynamic Host Configuration Protocol (DHCP) server: Assigns IP addresses to PXE clients and provides location information for boot files.

[0050] 2. Trivial File Transfer Protocol (TFTP) server: used to transfer startup files, such as boot programs and kernel images.

[0051] 3. Hypertext Transfer Protocol (HTTP) / File Transfer Protocol (FTP) server (optional): used to transfer larger files or provide additional services.

[0052] 4. Network File System (NFS) / Server Message Block (SMB) server (optional): used to provide a network file system and support PXE clients to access operating system image files.

[0053] In order to save resources, a PXE server usually integrates a DHCP server, a TFTP server, and an HTTP server. In the same LAN, generally only one PXE server can be started at the same time, and there is only one operating system image on the PXE server. When a server or virtual machine in the LAN is started through PXE, it will automatically obtain an IP address from the DHCP server in the LAN, and automatically obtain OS boot files from the TFTP server, and obtain the installation image file through the HTTP server to install the OS.

[0054] However, PXE has some disadvantages. For example, if there are multiple DHCP servers or multiple PXE servers (with different OS installed) in the environment, it may cause confusion on the DHCP server, and the OS installed on the server or virtual machine may not meet expectations, or the OS cannot be installed. For another example, if the OS installed on the server or virtual machine is different (such as OS1 installed on server 1 and OS2 installed on server 2), it cannot meet the needs and the configuration of the TFTP server and HTTP server needs to be readjusted. For another example, the current PXE cannot install OS for servers or virtual machines in other LANs because DHCP broadcast packets cannot penetrate the LAN.

[0055] Virtual Local Area Network (VLAN) is a technology that logically divides LAN devices into segments. These segments work in the same physical LAN, but logically they are in different physical LANs. VLAN division is not limited by physical location and can be flexibly divided according to actual needs.

[0056] Based on this, this specification provides a method for implementing PXE installation in combination with VLAN technology. For a created virtual machine, according to the BIOS mode selected for the virtual machine and the type of OS to be installed, the IP address of the VLAN gateway corresponding to the virtual machine is obtained from a preset mapping table, and the DHCP relay is triggered by the virtual machine to send a unicast packet for requesting the IP address of the virtual machine. Then, through the DHCP relay, a response message returned by the DHCP server is received, wherein the response message carries the IP address of the virtual machine, the first boot file path, and the IP address of the TFTP server. Finally, through the virtual machine, according to the response message, the installation is completed.

[0057] This method can directly obtain the IP address of the VLAN gateway corresponding to the virtual machine from the preset mapping table according to the BIOS mode selected for the virtual machine and the type of OS to be installed. In addition, the first boot file path can be determined according to the preset mapping table, and the first boot file path does not need to be manually configured, thus avoiding the cumbersome configuration process. The entire installation process does not require manual participation, and the degree of automation is high.

[0058] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.

[0059] Figure 1 The following is a flow chart of a method for implementing PXE installation by combining VLAN technology provided in this specification, including the following steps:

[0060] S101: For a created virtual machine, according to a basic input and output system BIOS mode selected for the virtual machine and the type of operating system OS to be installed, an IP address of a VLAN gateway corresponding to the virtual machine is obtained from a preset mapping table.

[0061] In this specification, the execution subject for implementing a method for implementing PXE installation in combination with VLAN technology can be a terminal device such as a laptop computer, a tablet computer, or of course, a cloud platform integrated on a physical machine. For the sake of ease of description, this specification only takes the cloud platform as an execution subject as an example to illustrate a method for implementing PXE installation in combination with VLAN technology provided in this specification.

[0062] For the created virtual machine, the cloud platform obtains the IP address of the VLAN gateway corresponding to the virtual machine from the preset mapping table according to the BIOS mode selected for the virtual machine and the type of OS to be installed. The preset mapping table is used to represent the correspondence between the IP address of the VLAN gateway, the type of OS that can be installed, and the BIOS mode, such as Figure 2 shown.

[0063] Figure 2 A schematic diagram of a mapping table provided in this specification.

[0064] from Figure 2 It can be seen that the mapping table may include VID (VLAN ID), OS type, BIOS mode, first boot file name, response file name and VLAN gateway IP address, and different BIOS modes and OS types correspond to different VID, first boot file name, response file name and VLAN gateway IP address. Among them, when the BIOS mode and OS type have been selected for the virtual machine, VID is used to indicate the VLAN network identifier of the VLAN network corresponding to the virtual machine when the BIOS mode and OS type are selected.

[0065] After the user has selected the BIOS mode and the type of OS to be installed for the virtual machine, the cloud platform can determine the VID, first boot file name, response file name and IP address of the VLAN gateway corresponding to the virtual machine based on the mapping table when the user selects the BIOS mode and OS type.

[0066] In some embodiments, the mapping table may be stored in the cloud platform. In other embodiments, the mapping table may also be stored in other locations, as long as the cloud platform, the DHCP server, and the TFTP server can all obtain the mapping table. Figure 2 The mapping table in only includes two OSs. In actual applications, the cloud platform can also add multiple OSs and the first boot file name, response file name, etc. corresponding to each OS in the mapping table.

[0067] Specifically, the cloud platform can first create a virtual machine according to the configuration parameters of the virtual machine selected by the user. Among them, the configuration parameters include the name of the virtual machine, the size of the central processing unit (CPU), the memory size, the size of the cloud disk, the storage location, and the planned loading network. The planned loading network here is the network that the user will eventually use. During the actual installation process, a virtual network card (i.e., the VLAN network corresponding to the virtual machine) can be temporarily loaded for the virtual machine. After the installation is completed, the temporary network will be uninstalled, and then the planned loading network selected by the user will be used. Among them, the virtual machine can be configured by the cloud platform in the physical machine where the cloud platform is located.

[0068] Then, the cloud platform can display the BIOS mode and OS type contained in the mapping table on the initial selection interface of the virtual machine through the virtual machine, and obtain the BIOS mode and OS type selected by the user for the virtual machine based on the user's selection operation on the initial selection interface.

[0069] Furthermore, the cloud platform queries the VID and IP address of the VLAN gateway corresponding to the virtual machine in the case of the selected BIOS mode and OS type from the mapping table, creates a VLAN network for the virtual machine according to the VID (one VID corresponds to one VLAN network), and uses the IP address of the VLAN gateway queried from the mapping table as the IP address of the configured VLAN gateway in the VLAN network. In addition, one of the virtual network cards in the VLAN network needs to be mapped to the virtual machine (only the virtual network card is mounted, and the virtual network cards on other networks are not mounted), and the virtual machine is set to start with the PXE method.

[0070] It should be noted that there are two main BIOS modes: UEFI and Legacy. Legacy is the boot mode used in early computers. The Legacy BIOS interface is simple, mainly using a blue-gray background text interface, supporting MBR partition table, and supporting a maximum of 2TB of hard disk space. UEFI is a modern BIOS boot mode that has gradually replaced the traditional Legacy BIOS since 2011. UEFI provides a modern, simplified graphical user interface suitable for novice operations, supports larger hard drives and partitions, and advanced security and performance features (such as faster loading of operating systems, allowing network drivers to be updated without starting the OS, etc.).

[0071] There are many types of OS. Newer versions of OS can use UEFI boot mode, while older versions of OS may not support UEFI and can only use Legacy boot mode. In some embodiments, if the BIOS mode selected by the user is incompatible with the type of OS, the cloud platform can prompt the user through the virtual machine to prompt the user to reselect a compatible BIOS mode and OS type.

[0072] It should also be noted that the cloud platform can create multiple virtual machines at the same time. If multiple virtual machines are created at the same time, it is necessary to select a network card that is interconnected on each physical machine where the cloud platform is located, such as em1, set the corresponding port to trunk mode, and create the VLAN network involved in the mapping table in advance, and add all the VLAN networks involved in the mapping table to em1 so that the virtual machine can communicate normally. In addition, each of the above VLAN networks corresponds to a VLAN gateway. The cloud platform can pre-configure static routing between the DHCP server and the VLAN gateway so that the DHCP server can communicate with the VLAN gateway.

[0073] In addition, the cloud platform in this manual is an installation task performed based on installation instructions or installation programs installed in the cloud platform. The entire installation process does not require human participation, and the cloud platform can automatically complete the installation task.

[0074] S102: Triggering a Dynamic Host Configuration Protocol DHCP relay through the virtual machine to send a unicast packet for requesting an IP address of the virtual machine.

[0075] Because the LAN isolates broadcast packets, in this manual, the DHCP broadcast packets sent directly by the virtual machine to the DHCP server cannot penetrate the LAN. In order to allow multiple LANs to share the same DHCP server, the DHCP relay function can be used. The DHCP relay is responsible for forwarding DHCP messages between the virtual machine and the DHCP server, and is a device that assists the DHCP server in dynamically allocating network parameters to the virtual machine.

[0076] The client sends a DHCP broadcast packet to the DHCP relay. The DHCP relay will modify the message format and generate a new DHCP message, then unicast forward it to the DHCP server. The DHCP server returns a unicast packet to the DHCP relay, which is then modified by the DHCP relay and responded to the virtual machine in the form of broadcast.

[0077] Therefore, in this specification, the cloud platform triggers the DHCP relay through the virtual machine to send a unicast packet to the DHCP server for requesting the IP address of the virtual machine, wherein the DHCP relay is pre-configured on the VLAN gateway, and the unicast packet carries the IP address of the DHCP relay, and the IP address of the DHCP relay is the IP address of the VLAN gateway.

[0078] In some embodiments, the cloud platform can send a broadcast packet for requesting the IP address of the virtual machine in the form of a broadcast through the virtual machine, wherein the broadcast packet for requesting the IP address of the virtual machine carries the MAC address of the virtual machine, where the MAC address is used to represent the unique identifier of each virtual machine. Further, the cloud platform receives the broadcast packet sent by the virtual machine in the form of a broadcast through the DHCP relay configured in the VLAN gateway corresponding to the virtual machine, and determines the unicast packet for requesting the IP address of the virtual machine based on the broadcast packet for requesting the IP address of the virtual machine, and then sends a unicast packet to the DHCP server, wherein the unicast packet for requesting the IP address of the virtual machine carries the MAC address of the virtual machine and the IP address of the VLAN gateway.

[0079] S103: Receive a response message returned by the DHCP server through the DHCP relay.

[0080] The cloud platform receives a response message returned by the DHCP server through the DHCP relay. The response message carries the MAC address of the virtual machine, the IP address of the virtual machine, the first boot file path, and the IP address of the TFTP server.

[0081] The response message carries the IP address assigned by the DHCP server to the virtual machine, the first boot file path, and the IP address of the TFTP server. The IP address of the virtual machine is determined by the DHCP server according to the IP address of the DHCP relay carried in the unicast packet used to request the IP address of the virtual machine. Specifically, the DHCP server can determine the address pool according to the IP address of the DHCP relay in the unicast packet, and select an IP address from the address pool as the IP address of the virtual machine. The first boot file path is determined by the DHCP server according to the IP address of the DHCP relay carried in the unicast packet used to request the IP address of the virtual machine and the mapping table.

[0082] Specifically, after the DHCP server receives the unicast packet for requesting the IP address of the virtual machine, the cloud platform can determine the configuration file in the DHCP server according to the preset mapping table, so that the DHCP server can determine the response message according to the configuration file and the unicast packet for requesting the IP address of the virtual machine, and return it to the DHCP relay. The format of the configuration file mentioned in the above process can be as follows: Figure 3 The format shown.

[0083] Figure 3 A schematic diagram of the format of a configuration file provided for this application.

[0084] from Figure 3As can be seen, the cloud platform determines the address pool in the configuration file based on the IP address of the VLAN gateway, so that the DHCP server allocates an IP address to the virtual machine according to the address pool in the configuration file. There are also the IP address of the DHCP relay, the first boot file path, and the IP address of the TFTP server carried in the unicast packet used to request the IP address of the virtual machine in the configuration file. The <BIOS mode>, <OS type>, and <first boot file name> in the first boot file path can be obtained from the mapping table according to the IP address of the DHCP relay carried in the unicast packet used to request the IP address of the virtual machine received by the DHCP server, and the BIOS mode, OS type, and first boot file name corresponding to the IP address of the DHCP relay are filled into the corresponding positions in the configuration file. The IP address of the TFTP server can be pre-determined.

[0085] Furthermore, the DHCP server generates a response message according to the configuration file and returns the response message to the DHCP relay. The DHCP relay modifies the format of the response message and then sends the modified response message in a broadcast form. The response message carries the MAC address of the virtual machine. At this time, the virtual machine can receive the response message sent by the DHCP relay. In some embodiments, there can be multiple virtual machines under a VLAN network. Therefore, when the cloud platform receives the response message from the DHCP relay through the virtual machine, it is necessary to first determine whether the MAC address in the response message is consistent with the MAC address of the current virtual machine. If they are consistent, the subsequent installation tasks can be completed according to the received response message.

[0086] It should be noted that in order to enable network intercommunication between the DHCP relay and the DHCP server, the cloud platform needs to configure the corresponding default route in the DHCP relay based on the user's preparation operations before performing the installation task, so that the DHCP relay can communicate with the DHCP server, and add a static route in the DHCP server so that the DHCP server can communicate with the DHCP relay.

[0087] S104: Complete the installation through the virtual machine according to the response message.

[0088] The cloud platform completes the installation through the virtual machine according to the response message. Specifically, the cloud platform can obtain the first boot file from the TFTP server through the virtual machine according to the IP address of the virtual machine in the response message, the first boot file path and the IP address of the TFTP server. The first boot file contains the boot menu configuration information and kernel loading parameters, which are used to guide the virtual machine to start and load the OS kernel. In other words, the BIOS mode and OS type selected by the user for the virtual machine are different, and the first boot file path is different. The cloud platform obtains different first boot files from the TFTP server through the virtual machine, and can install different OS for different virtual machines.

[0089] Then, the cloud platform executes the first boot file through the virtual machine, and obtains the determined second boot file from the TFTP server based on the first boot file, wherein the second boot file is used to guide the virtual machine to obtain the response file and display the configuration information of the OS in the virtual machine. The second boot file is executed through the virtual machine, and the response file is obtained from the TFTP server based on the second boot file, and the installation is completed based on the response file and the image file of the OS corresponding to the virtual machine obtained from the TFTP server.

[0090] Among them, after the cloud platform receives the request for the second boot file sent by the virtual machine on the TFTP server (the request carries the IP address of the VLAN gateway corresponding to the virtual machine), the cloud platform can determine the second boot file through the TFTP server according to the mapping table. Specifically, the cloud platform obtains the BIOS mode, OS type and response file name corresponding to the virtual machine from the mapping table through the TFTP server according to the IP address of the VLAN gateway carried in the request, and determines the second boot file according to the BIOS mode, OS type and response file name corresponding to the virtual machine. The format of the second boot file here is as follows: Figure 4A , 4B shown.

[0091] Figure 4A , 4B This is a schematic diagram of the format of a second boot file provided in this specification.

[0092] from Figure 4AIt can be seen that according to the mapping table, the BIOS mode, OS type and answer file name are filled into the corresponding positions in the second boot file, so as to correctly obtain vmlinuz, ks.cfg, initrd.img and other files through the virtual machine, among which vmlinuz is the executable file of the Linux kernel, which is used to start the OS; initrd.img is the initialization RAM disk image, which contains the drivers and tools required in the startup process; ks.cfg is the answer file, also known as the kickstart file, which is used for the automated installation of the Linux system. It contains command segments, software package segments and optional script segments, which define the system configuration, installation software package and post-installation scripts, and can realize unattended installation. According to the BIOS mode, OS type and answer file name corresponding to the virtual machine, the filled second boot file is as follows Figure 4B As shown. Among them, the answer file path in the second boot file can be <bios> / <os> / ks- <bios> - <os>.cfg, or <bios> / <os> / ks.cfg.

[0093] It should be noted that the cloud platform can pre-configure the Uniform Resource Locator (URL) of the response file. The URL of the response file can be "url--url = http: / / <server> / <dir>", used to obtain the OS image file from the HTTP server, or "url--url ftp: / / <username> : <password> @ <server> / <dir>", used to obtain the image file of the OS from the FTP server. For example, if the url instruction is used in the answer file to specify the image file of CentOS 6.6 on the FTP server: "url--url ftp: / / 172.17.62.160 / pub / centos6.6 / ". In this way, the cloud platform can use the existing YUM (Yellowdog Updater, Modified) source in the environment to save the space for storing image files on the cloud platform. The YUM source is a warehouse that stores a large number of RPM software packages and their metadata. These software packages can be compiled binary files that users can install directly on the system. Each software package contains the software itself, installation scripts, version information, dependencies, etc., and the metadata includes the description, version number, dependencies, etc. of the software package. YUM uses this information to resolve dependencies and ensure that the installed software packages can work together correctly.

[0094] In order to make the files obtained by the cloud platform from the TFTP server through the virtual machine more accurate, the cloud platform can pre-configure directories and files in the TFTP server so that the virtual machine can obtain the first boot file and response file corresponding to each virtual machine according to the first boot file path and response file path.

[0095] Specifically, the OS involved in the mapping table is first classified according to the BIOS mode, and the boot files corresponding to the OS are copied to the corresponding TFTP directory.

[0096] For example, in the default path of the TFTP server, you can first divide the directory by BIOS mode, into the following two directories: / var / lib / tftpboot / legacy and / var / lib / tftpboot / uefi, corresponding to the two BIOS modes: legacy and uefi. Each BIOS mode is further divided into multiple directories by the type of OS. If there are two OSs in the Legacy mode, centos6.6 and centos7.6, the directory under the TFTP server can be:

[0097] / var / lib / tftpboot / legacy / centos66

[0098] / var / lib / tftpboot / legacy / centos76

[0099] Then, the cloud platform copies the relevant files in the corresponding OS to the corresponding directory of the TFTP server ( / var / lib / tftpboot / <BIOS mode> / <OS type>), such as the first boot file, the second boot file, the response file, initrd.img, vmlinuz, etc. In this way, when the types of OS to be installed on the virtual machine and the BIOS mode are different, different files can be obtained from different TFTP server directories according to the first boot file path, the second boot file path, etc.

[0100] It should be noted that in the method of this specification, the cloud platform can create multiple virtual machines at the same time. For each virtual machine, the corresponding VID of the virtual machine can be obtained according to the preset mapping table, and a VLAN network is created. If the BIOS modes and OS types to be installed on two virtual machines are the same, then the VIDs and the VLAN networks where the two virtual machines are located are the same, and the IP addresses of the VLAN gateways corresponding to the two virtual machines are also the same. Therefore, the first boot file, the second boot file, etc. obtained by the two virtual machines from the TFTP server are the same. If the BIOS modes and OS types to be installed on two virtual machines are different, then the cloud platform can obtain different first boot files and response files through the different first boot file names and response file names corresponding to the virtual machines under this BIOS mode and OS type in the mapping table, so as to install different OSs for different virtual machines.

[0101] After the cloud platform completes the OS installation task for the virtual machine, it automatically sets the startup method of the virtual machine to start from the hard disk or optical drive, cancels the virtual network card mounted during installation, and actively deletes the VLAN network (including the corresponding VLAN gateway settings on the DHCP relay) automatically created for the virtual machine during installation.

[0102] Furthermore, the cloud platform mounts the virtual network card in the network selected by the user for the virtual machine after installation, and automatically obtains an IP address for the virtual machine according to the DHCP server in this network. Alternatively, the user can manually assign an IP address to the virtual machine.

[0103] Next, this specification will use an example to explain in detail the method of implementing PXE installation in combination with VLAN technology. Specifically, the cloud platform creates a virtual machine according to parameters such as the BIOS mode, OS type, virtual machine name, central processing unit (CPU) size, memory size, cloud disk size, storage location, and planned loading network selected by the user. Then, the cloud platform starts the virtual machine, and according to the mapping table (reads the VID and the IP address of the VLAN gateway), creates a VLAN network, configures a VLAN gateway for the VLAN network, and configures a DHCP relay in the VLAN gateway.

[0104] Furthermore, the cloud platform mounts a virtual network card from the VLAN network to the virtual machine, and restarts the virtual machine. The virtual machine sends a broadcast packet to the DHCP relay through the virtual network card, and the DHCP relay forwards the unicast packet corresponding to the broadcast packet to the DHCP server. Then, the virtual machine can obtain the IP address (only a temporary IP address), the first boot file path (determined by the DHCP server according to the mapping table), and the IP address of the TFTP server from the DHCP server, and then perform the installation task according to the PXE principle. After the installation is completed, the cloud platform uninstalls the virtual network card mounted on the virtual machine and mounts the planned loading network selected by the user when creating the virtual machine.

[0105] In this specification, the method in this application can automatically install different OS for multiple virtual machines by combining VLAN network, which solves the problem of slow manual installation efficiency, saves human resources, and realizes automatic installation. And the automation level is high, the management is convenient and efficient, and the installation efficiency is greatly improved.

[0106] In addition, the second boot file in the present invention can be determined by a mapping table. Since different virtual machines have corresponding response files different when installed, the cloud platform can store the files required for installing different OS in the TFTP server in advance, and determine the path of the response file in the TFTP server according to the BIOS mode, OS type and response file name corresponding to the virtual machine stored in the mapping table. In this way, the cloud platform can automatically install different OS for different virtual machines.

[0107] In addition, the cloud platform maintains a mapping table that contains mapping relationships between parameters such as VID (VLAN ID), VLAN gateway IP address, BIOS mode, and OS type. The configuration file in the DHCP server can automatically query the mapping table based on the IP address of the VLAN gateway in the received unicast packet, fill in the network segment, the IP address of the TFTP server, and the first boot file path, that is, the DHCP server can automatically combine and reply to the information required for installation based on the mapping table. The VLAN network and DHCP relay created during the installation process can be automatically configured according to the installation information and automatically deleted after use.

[0108] The above is a method for implementing PXE installation by combining VLAN technology with one or more implementations of this specification. Based on the same idea, this specification also provides a corresponding device for implementing PXE installation by combining VLAN technology, such as Figure 5 shown.

[0109] Figure 5 A schematic diagram of a device for implementing PXE installation in combination with VLAN technology provided in this specification includes:

[0110] The acquisition module 501 is used to acquire, for the created virtual machine, the IP address of the VLAN gateway corresponding to the virtual machine from a preset mapping table according to the basic input and output system BIOS mode selected for the virtual machine and the type of operating system OS to be installed;

[0111] The request module 502 is used to trigger the Dynamic Host Configuration Protocol DHCP relay through the virtual machine to send a unicast packet for requesting the IP address of the virtual machine; the DHCP relay is configured on the VLAN gateway; the unicast packet carries the IP address of the DHCP relay; the IP address of the DHCP relay is the IP address of the VLAN gateway;

[0112] The receiving module 503 is used to receive a response message returned by the DHCP server through the DHCP relay, wherein the response message carries the IP address of the virtual machine, the first boot file path, and the IP address of a Trivial File Transfer Protocol TFTP server;

[0113] The installation module 504 is used to complete the installation through the virtual machine according to the response message.

[0114] Optionally, the acquisition module 501 is specifically used to obtain configuration parameters of the virtual machine, the configuration parameters including the virtual machine name, central processing unit CPU size, memory size, cloud disk size, storage location, and planned loading network; and create the virtual machine according to the configuration parameters.

[0115] Optionally, the request module 502 is specifically used to send a broadcast packet for requesting the IP address of the virtual machine through the virtual machine; receive the broadcast packet through the DHCP relay, and determine a unicast packet for requesting the IP address of the virtual machine based on the broadcast packet, and send the unicast packet to the DHCP server.

[0116] Optionally, the receiving module 503 is specifically configured to determine the IP address of the virtual machine through the DHCP server according to the IP address of the DHCP relay carried in the unicast packet.

[0117] Optionally, the receiving module 503 is specifically configured to determine the first boot file path through the DHCP server according to the IP address of the DHCP relay carried in the unicast packet and the mapping table.

[0118] Optionally, the installation module 504 is specifically used to, through the virtual machine, obtain a first boot file from the TFTP server according to the response message, the first boot file containing startup menu configuration information and kernel loading parameters for guiding the virtual machine to start and load the OS kernel; through the virtual machine, obtain a determined second boot file from the TFTP server according to the first boot file, the second boot file being used to guide the virtual machine to obtain a response file and display the configuration information of the OS in the virtual machine; through the virtual machine, obtain the response file from the TFTP server according to the second boot file, and complete the installation according to the response file and the image file of the OS obtained from the TFTP server.

[0119] Optionally, the installation module 504 is specifically used to obtain the BIOS mode, OS type and response file name corresponding to the virtual machine from the mapping table through the TFTP server, and determine the second boot file according to the BIOS mode, OS type and response file name.

[0120] This specification also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 A method for implementing PXE installation by combining VLAN technology is provided.

[0121] This manual also provides Figure 6 The one shown corresponds to Figure 1 A schematic diagram of the electronic device. Figure 6 As mentioned above, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 The method of implementing PXE installation by combining VLAN technology. Of course, in addition to the software implementation, this specification does not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0122] For the improvement of a technology, it can be clearly distinguished whether it is a hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or a software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0123] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0124] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0125] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0126] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0127] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0128] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0129] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0130] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0131] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0132] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0133] It should also be noted that the term "includes", "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the existence of other identical elements in the process, method, commodity or device including the element.

[0134] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0135] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0136] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0137] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.< / dir> < / server> < / password> < / username> < / dir> < / server> < / os> < / bios> < / os> < / bios> < / os> < / bios>

Claims

1. A method for implementing PXE installation in combination with VLAN technology, characterized in that: include: For the created virtual machine, according to the basic input and output system BIOS mode selected for the virtual machine and the type of operating system OS to be installed, the IP address of the VLAN gateway corresponding to the virtual machine is obtained from a preset mapping table; Triggering a Dynamic Host Configuration Protocol DHCP relay through the virtual machine to send a unicast packet for requesting an IP address of the virtual machine; The DHCP relay is configured on the VLAN gateway; The unicast packet carries the IP address of the DHCP relay; the IP address of the DHCP relay is the IP address of the VLAN gateway; Receiving, through the DHCP relay, a response message returned by the DHCP server, wherein the response message carries the IP address of the virtual machine, the first boot file path, and the IP address of a Trivial File Transfer Protocol (TFTP) server; The installation is completed through the virtual machine according to the response message.

2. The method according to claim 1, characterized in that Create a virtual machine, including: Obtain the configuration parameters of the virtual machine, including the name of the virtual machine, the size of the central processing unit (CPU), the memory size, the size of the cloud disk, the storage location, and the planned loading network; The virtual machine is created according to the configuration parameters.

3. The method according to claim 1, characterized in that Triggering a Dynamic Host Configuration Protocol DHCP relay through the virtual machine to send a unicast packet for requesting the IP address of the virtual machine specifically includes: Sending, through the virtual machine, a broadcast packet for requesting the IP address of the virtual machine; The broadcast packet is received through the DHCP relay, and a unicast packet for requesting the IP address of the virtual machine is determined according to the broadcast packet, and the unicast packet is sent to the DHCP server.

4. The method according to claim 1, characterized in that The IP address of the virtual machine is determined by the DHCP server according to the IP address of the DHCP relay carried in the unicast packet.

5. The method according to claim 1, characterized in that The first boot file path is determined by the DHCP server according to the IP address of the DHCP relay carried in the unicast packet and the mapping table.

6. The method according to claim 1, characterized in that The installation is completed by the virtual machine according to the response message, specifically including: Obtaining, by the virtual machine, a first boot file from the TFTP server according to the response message, wherein the first boot file includes boot menu configuration information and kernel loading parameters for guiding the virtual machine to start and load the OS kernel; Obtaining, through the virtual machine, a determined second boot file from the TFTP server according to the first boot file, wherein the second boot file is used to guide the virtual machine to obtain a response file and to display configuration information of the OS in the virtual machine; The response file is obtained from the TFTP server according to the second boot file through the virtual machine, and the installation is completed according to the response file and the image file of the OS obtained from the TFTP server.

7. The method according to claim 6, characterized in that Determine the second boot file, specifically including: The BIOS mode, the OS type and the response file name corresponding to the virtual machine are obtained from the mapping table through the TFTP server, and the second boot file is determined according to the BIOS mode, the OS type and the response file name.

8. A device for implementing PXE installation in combination with VLAN technology, characterized in that: include: An acquisition module is used to acquire, for a created virtual machine, an IP address of a VLAN gateway corresponding to the virtual machine from a preset mapping table according to a basic input and output system BIOS mode selected for the virtual machine and a type of an operating system OS to be installed; A request module, used for triggering a Dynamic Host Configuration Protocol DHCP relay to send a unicast packet for requesting an IP address of the virtual machine through the virtual machine; The DHCP relay is configured on the VLAN gateway; The unicast packet carries the IP address of the DHCP relay; the IP address of the DHCP relay is the IP address of the VLAN gateway; A receiving module, configured to receive a response message returned by the DHCP server through the DHCP relay, wherein the response message carries the IP address of the virtual machine, the first boot file path, and the IP address of a Trivial File Transfer Protocol TFTP server; The installation module is used to complete the installation through the virtual machine according to the response message.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Object processing method of automatic memory system and related equipment thereof

    CN120803556A