A method and apparatus for WiFi connection in a Linux system
By loading and packaging the basic environment data of the network card driver in a container, the problem of difficult network card driver installation in Linux systems is solved, and efficient WiFi connectivity is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUIZHIAN INFORMATION TECH CO LTD
- Filing Date
- 2023-07-31
- Publication Date
- 2026-06-16
AI Technical Summary
In Linux systems, many network card drivers are either unavailable or difficult to install, making it difficult to connect to WiFi easily.
By preloading the network card driver in a container and packaging it as basic environment data that can run in a virtual machine, the installation process of the network card driver is simplified. Container technology is used as a data transmission bridge to realize data transmission between the virtual machine and the target network card.
It improves the efficiency of network card driver installation, simplifies the process of connecting a Linux system to WiFi, and avoids the complexity of installing network card drivers directly in a virtual machine.
Smart Images

Figure CN117215715B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a WiFi connection method and apparatus for Linux systems. Background Technology
[0002] In current software development processes, it's common to encounter situations where a virtual machine running Ubuntu needs to connect to WiFi. This requires installing the corresponding network card driver on the Ubuntu system. Many network card drivers are not available for installation on Linux systems, or installing them on Linux can be quite difficult, making it difficult for Linux systems to easily connect to WiFi. Summary of the Invention
[0003] This invention provides a WiFi connection method and apparatus for Linux systems, which simplifies the process of connecting Linux systems to WiFi.
[0004] In view of this, the present invention provides a WiFi connection method for a Linux system, the method comprising:
[0005] When the current virtual machine starts, check if a network adapter driver suitable for the virtual machine exists;
[0006] If no network card driver is available for the virtual machine, identify the system version of the virtual machine and determine a target container in the preset container group that is compatible with the version environment of the system version.
[0007] Load the network card driver into the target container, and package the target container with the network card driver loaded into basic environment data that can run in a virtual machine;
[0008] The basic environment data is run in the virtual machine to drive the target network card of the device where the virtual machine is located, and to transmit data between the virtual machine and the target network card through the basic environment data after it is run.
[0009] In one implementation, detecting the existence of a network card driver suitable for the virtual machine includes:
[0010] The system identifier of the device where the current virtual machine is located is identified, and a program identifier that maps to the system identifier is queried in a preset identifier mapping table. The program identifier is used to characterize the network card driver.
[0011] In one implementation, determining a target container within a preset container group that is compatible with the version environment of the system version includes:
[0012] Obtain the list of base images corresponding to the preset container group;
[0013] In the list of base images, a target base image that is compatible with the version environment of the system version is queried, and the container that loads the target base image is identified as the target container that is compatible with the version environment of the system version.
[0014] In one implementation, transmitting data between the virtual machine and the target network interface card using post-running basic environment data includes:
[0015] The system receives the data to be transmitted from the virtual machine and repackages the data according to the network data format represented by the basic environment data to generate network data that conforms to the network data format.
[0016] The network data is sent to the target network card so that the network data can be sent outward through the target network card.
[0017] In one implementation, transmitting data between the virtual machine and the target network interface card using post-running basic environment data includes:
[0018] Receive network data transmitted from the target network card, and extract data bodies from the network data;
[0019] The extracted data body is repackaged according to the format required by the virtual machine, and the repackaged data is sent to the virtual machine.
[0020] Another aspect of the present invention provides a WiFi connection device for a Linux system, the device comprising:
[0021] The program detection unit is used to detect whether a network card driver suitable for the virtual machine exists when the current virtual machine starts up;
[0022] The container determination unit is used to identify the system version of the virtual machine if there is no network card driver suitable for the virtual machine, and determine the target container in the preset container group that is compatible with the version environment of the system version.
[0023] A data packaging unit is used to load the network card driver into the target container and package the target container with the network card driver loaded into basic environment data that can run in a virtual machine;
[0024] The data execution unit is used to run the basic environment data in the virtual machine, so as to drive the target network card of the device where the virtual machine is located through the basic environment data, and to transmit data between the virtual machine and the target network card through the runnable basic environment data.
[0025] In one embodiment, the program detection unit is specifically used to identify the system identifier of the device where the current virtual machine is located, and to query in a preset identifier mapping table whether there is a program identifier that maps to the system identifier, wherein the program identifier is used to characterize the network card driver.
[0026] In one embodiment, the container determination unit is specifically used to: obtain a list of base images corresponding to the preset container group; query the list of base images to find a target base image that is compatible with the version environment of the system version; and determine the container loaded with the target base image as a target container that is compatible with the version environment of the system version.
[0027] The technical solution provided by this invention allows the network card driver required by a virtual machine to be pre-loaded in the corresponding container. Subsequently, by packaging the container with the network card driver loaded into runnable basic environment data, this basic environment data can be deployed to the virtual machine without directly installing the network card driver within the virtual machine. This significantly improves the installation efficiency of the network card driver, and the network card driver does not need to be compatible with the virtual machine. Data can then be transferred between the virtual machine and the network card using the basic environment data, thus simplifying the process of connecting a Linux system to WiFi.
[0028] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings.
[0029] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0030] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:
[0031] Figure 1 This is a schematic diagram illustrating the steps of a WiFi connection method for a Linux system according to an embodiment of the present invention;
[0032] Figure 2 This is a schematic diagram of the functional modules of a WiFi connection device for a Linux system according to an embodiment of the present invention. Detailed Implementation
[0033] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0034] Please see Figure 1 This invention provides a WiFi connection method for a Linux system, the method comprising:
[0035] S1: When the current virtual machine starts, check if there is a network card driver suitable for the virtual machine;
[0036] S2: If there is no network card driver suitable for the virtual machine, identify the system version of the virtual machine and determine the target container in the preset container group that is compatible with the version environment of the system version;
[0037] S3: Load the network card driver into the target container, and package the target container with the network card driver loaded into basic environment data that can run in a virtual machine;
[0038] S4: Run the basic environment data in the virtual machine to drive the target network card of the device where the virtual machine is located through the basic environment data, and transmit data between the virtual machine and the target network card through the runnable basic environment data.
[0039] In one implementation, detecting the existence of a network card driver suitable for the virtual machine includes:
[0040] The system identifier of the device where the current virtual machine is located is identified, and a program identifier that maps to the system identifier is queried in a preset identifier mapping table. The program identifier is used to characterize the network card driver.
[0041] In one implementation, determining a target container within a preset container group that is compatible with the version environment of the system version includes:
[0042] Obtain the list of base images corresponding to the preset container group;
[0043] In the list of base images, a target base image that is compatible with the version environment of the system version is queried, and the container that loads the target base image is identified as the target container that is compatible with the version environment of the system version.
[0044] In this embodiment, after identifying a compatible target container, a network interface card (NIC) driver can be loaded into the target container. This NIC driver can be the NIC driver required by the device hosting the virtual machine. Although the NIC driver may not be compatible with the virtual machine, it actually runs in the target container, not directly in the virtual machine.
[0045] In this embodiment, container packaging or container encapsulation techniques can be used to package the target container, which has loaded the network card driver, into basic environment data that can run in a virtual machine. After this basic environment data runs in the virtual machine, the target container will automatically take effect, and the network card driver in the target container will also automatically take effect, thereby initializing and configuring the network card of the device where the virtual machine is located.
[0046] Subsequently, the basic environment data after the system is running can serve as a data transmission bridge between the virtual machine and the network card, transmitting data between the virtual machine and the network card.
[0047] In one implementation, transmitting data between the virtual machine and the target network interface card using post-running basic environment data includes:
[0048] The system receives the data to be transmitted from the virtual machine and repackages the data according to the network data format represented by the basic environment data to generate network data that conforms to the network data format.
[0049] The network data is sent to the target network card so that the network data can be sent outward through the target network card.
[0050] In one implementation, transmitting data between the virtual machine and the target network interface card using post-running basic environment data includes:
[0051] Receive network data transmitted from the target network card, and extract data bodies from the network data;
[0052] The extracted data body is repackaged according to the format required by the virtual machine, and the repackaged data is sent to the virtual machine.
[0053] Network data can include a protocol header and a data body. After receiving network data, the protocol header can be removed to extract the data body. Then, the data body is repackaged according to the format required by the virtual machine, and the repackaged data can be passed to the virtual machine for processing.
[0054] Please see Figure 2 The present invention provides a WiFi connection device for a Linux system, the device comprising:
[0055] The program detection unit is used to detect whether a network card driver suitable for the virtual machine exists when the current virtual machine starts up;
[0056] The container determination unit is used to identify the system version of the virtual machine if there is no network card driver suitable for the virtual machine, and determine the target container in the preset container group that is compatible with the version environment of the system version.
[0057] A data packaging unit is used to load the network card driver into the target container and package the target container with the network card driver loaded into basic environment data that can run in a virtual machine;
[0058] The data execution unit is used to run the basic environment data in the virtual machine, so as to drive the target network card of the device where the virtual machine is located through the basic environment data, and to transmit data between the virtual machine and the target network card through the runnable basic environment data.
[0059] In one embodiment, the program detection unit is specifically used to identify the system identifier of the device where the current virtual machine is located, and to query in a preset identifier mapping table whether there is a program identifier that maps to the system identifier, wherein the program identifier is used to characterize the network card driver.
[0060] In one embodiment, the container determination unit is specifically used to: obtain a list of base images corresponding to the preset container group; query the list of base images to find a target base image that is compatible with the version environment of the system version; and determine the container loaded with the target base image as a target container that is compatible with the version environment of the system version.
[0061] The technical solution provided by this invention allows the network card driver required by a virtual machine to be pre-loaded in the corresponding container. Subsequently, by packaging the container with the network card driver loaded into runnable basic environment data, this basic environment data can be deployed to the virtual machine without directly installing the network card driver within the virtual machine. This significantly improves the installation efficiency of the network card driver, and the network card driver does not need to be compatible with the virtual machine. Data can then be transferred between the virtual machine and the network card using the basic environment data, thus simplifying the process of connecting a Linux system to WiFi.
[0062] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A WiFi connection method for a Linux system, characterized in that, The method includes: When the current virtual machine starts, check if a network adapter driver suitable for the virtual machine exists; If no network card driver is available for the virtual machine, identify the system version of the virtual machine and determine a target container in the preset container group that is compatible with the version environment of the system version. Load the network card driver into the target container, and package the target container with the network card driver loaded into basic environment data that can run in a virtual machine; The basic environment data is run in the virtual machine to drive the target network card of the device where the virtual machine is located, and data is transmitted between the virtual machine and the target network card through the runnable basic environment data; The data transmission between the virtual machine and the target network card, based on the basic environment data after operation, includes: The system receives the data to be transmitted from the virtual machine and re-encapsulates the data according to the network data format characterized by the basic environment data to generate network data that conforms to the network data format; the system then sends the network data to the target network card to transmit the network data outward through the target network card. Receive network data transmitted from the target network card and extract data body from the network data; repackage the extracted data body according to the format required by the virtual machine, and send the repackaged data to the virtual machine.
2. The method according to claim 1, characterized in that, Detecting the existence of a network adapter driver suitable for the virtual machine includes: The system identifier of the device where the current virtual machine is located is identified, and a program identifier that maps to the system identifier is queried in a preset identifier mapping table. The program identifier is used to characterize the network card driver.
3. The method according to claim 1, characterized in that, The target containers identified in the preset container group that are compatible with the version environment of the system version include: Obtain the list of base images corresponding to the preset container group; In the list of base images, a target base image that is compatible with the version environment of the system version is queried, and the container that loads the target base image is identified as the target container that is compatible with the version environment of the system version.
4. A WiFi connection device for a Linux system, characterized in that, The device includes: The program detection unit is used to detect whether a network card driver suitable for the virtual machine exists when the current virtual machine starts up; The container determination unit is used to identify the system version of the virtual machine if there is no network card driver suitable for the virtual machine, and determine the target container in the preset container group that is compatible with the version environment of the system version. A data packaging unit is used to load the network card driver into the target container and package the target container with the network card driver loaded into basic environment data that can run in a virtual machine; The data execution unit is used to run the basic environment data in the virtual machine, so as to drive the target network card of the device where the virtual machine is located through the basic environment data, and to transmit data between the virtual machine and the target network card through the runnable basic environment data; The data transmission between the virtual machine and the target network card, based on the basic environment data after operation, includes: The system receives the data to be transmitted from the virtual machine and re-encapsulates the data according to the network data format characterized by the basic environment data to generate network data that conforms to the network data format; the system then sends the network data to the target network card to transmit the network data outward through the target network card. Receive network data transmitted from the target network card and extract data body from the network data; repackage the extracted data body according to the format required by the virtual machine, and send the repackaged data to the virtual machine.
5. The apparatus according to claim 4, characterized in that, The program detection unit is specifically used to identify the system identifier of the device where the current virtual machine is located, and to query in a preset identifier mapping table whether there is a program identifier that maps to the system identifier. The program identifier is used to characterize the network card driver.
6. The apparatus according to claim 4, characterized in that, The container determination unit is specifically used to: obtain a list of base images corresponding to the preset container group; query the list of base images to find a target base image that is compatible with the version environment of the system version; and determine the container loaded with the target base image as the target container that is compatible with the version environment of the system version.