Subnet mask configuration method and device, storage medium and electronic equipment

By parsing and configuring the mask configuration mode of the communication module, and dynamically or statically configuring the subnet mask, the problems of communication failures and IP address conflicts between devices in a private network environment are solved, and the compatibility of the communication module in different network environments is improved.

CN116599932BActive Publication Date: 2026-07-31FIBOCOM WIRELESS SOFTWARE INC
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
FIBOCOM WIRELESS SOFTWARE INC
Filing Date
2023-06-09
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

In a private network environment, communication between devices is prone to failure, especially ping failures caused by unreasonable subnet mask design, and the inability of multi-module devices to obtain IP addresses.

Method used

After sending a PDN dial-up request to the network, the mask configuration mode of the target communication module is parsed, and the subnet mask is configured according to the mode, including dynamic or static methods. Dynamic configuration of the subnet mask is used to resolve IP address conflicts and inter-device communication issues.

Benefits of technology

It enables normal data services in different network environments, improves the compatibility of communication modules, and solves the problems of devices being unable to ping each other in private network environments and improper IP address acquisition in multi-module environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116599932B_ABST
    Figure CN116599932B_ABST
Patent Text Reader

Abstract

This invention provides a subnet mask configuration method, apparatus, storage medium, and electronic device. The method includes: sending a Packet Data Network (PDN) dial-up request to a network end; after successful PDN activation, parsing the mask configuration mode of the target communication module, wherein the mask configuration mode indicates the method for obtaining the WAN port mask of the target communication module; and configuring the subnet mask of the target communication module according to the mask configuration mode. Through this invention, the technical problem of a single subnet mask configuration method in related technologies is solved. Different subnet mask configuration methods are available for users to choose from, ensuring normal data service functionality after dialing in different network environments. It also solves the problems of ping failures under different settings in private network environments and the inability to obtain IP addresses for multiple modules on the same device, improving the compatibility of communication modules in different network environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communications, and more specifically, to a method and apparatus for configuring a subnet mask, a storage medium, and an electronic device. Background Technology

[0002] In related technologies, due to the rapid development of the Internet of Things (IoT), network environments have become increasingly complex and variable, especially in the increasingly widespread application of private network environments. A private network is a network built to meet the needs of IoT development, including abundant number resources, the "scale, mobility, and security" characteristics of IoT, personalized business requirements, and high-quality network assurance for customers. IoT users use dedicated numbers. In a private network environment, because IP addresses are fixed and often bound to SIM cards, when different devices obtain IP addresses that are close together, communication failures may occur between different devices due to an unreasonable subnet mask design.

[0003] In related technologies, after a module initiates a PDN (Packet Data Network) dial-up connection, its WAN (Wide Area Network) port obtains the corresponding IP address, subnet mask, and gateway address from the base station. According to current subnet mask and gateway calculation rules, there is a possibility of data communication failure between two devices in a private network environment. When device 1's IP address is 192.168.200.72 and device 2's IP address is 172.168.200.73, since 192.168.200.72 is a network address, not a host address, for 192.168.200.73, the received data packet will not be forwarded to the upper-layer application, resulting in a ping failure. Furthermore, because customers in a private network environment need to connect multiple module devices to the same host computer, each module has its own network card. Due to IP address conflicts, some module network cards on the host computer may fail to obtain IP addresses.

[0004] No efficient and accurate solution has yet been found to address the aforementioned issues in the relevant technologies. Summary of the Invention

[0005] This invention provides a method and apparatus for configuring subnet masks, a storage medium, and an electronic device to solve the aforementioned technical problems existing in related technologies.

[0006] According to an embodiment of the present invention, a method for configuring a subnet mask is provided, comprising: sending a Packet Data Network (PDN) dialing request to a network end; after successful PDN activation, parsing the mask configuration mode of a target communication module, wherein the mask configuration mode is used to indicate the method for obtaining the WAN port mask of the target communication module; and configuring the subnet mask of the target communication module according to the mask configuration mode.

[0007] Optionally, before parsing the mask configuration mode of the target communication module, the method further includes: detecting a user configuration request through the host computer of the target communication module; responding to the user configuration request and generating a mask configuration instruction for the target communication module based on the user configuration request; and configuring the mask configuration mode of the target communication module using the mask configuration instruction.

[0008] Optionally, configuring the target communication module mask configuration mode using the mask configuration instruction includes: locating the nv configuration file in the configuration information of the target communication module; and configuring the dhcp_subnetmask_calc parameter of the nv configuration file using the mask configuration instruction to configure the target communication module mask configuration mode.

[0009] Optionally, parsing the mask configuration pattern of the target communication module includes: reading the mask configuration parameters of the target communication module; reading the field value of a specified field in the mask configuration parameters; and searching for a mask configuration pattern that matches the field value in a preset mapping table.

[0010] Optionally, searching for a mask configuration pattern matching the field value in a preset mapping table includes: if the field value is a first field value, searching for a first mask configuration pattern matching the first field value in the preset mapping table, wherein the first mask configuration pattern is used to indicate that the subnet mask is calculated based on the IP address; if the field value is a second field value, searching for a second mask configuration pattern matching the second field value in the preset mapping table, wherein the second mask configuration pattern is used to indicate that the subnet mask is calculated based on the class of the IP address; if the field value is a third field value, searching for a third mask configuration pattern matching the third field value in the preset mapping table, wherein the third mask configuration pattern is used to indicate that a static mask address is used.

[0011] Optionally, configuring the subnet mask of the target communication module according to the mask configuration mode includes: obtaining the IP address of the target communication module; creating a dnsmasq process in the target communication module, and using the dnsmasq process to configure the subnet mask of the target communication module's Dynamic Host Configuration Protocol (DHCP) based on the mask configuration mode and the IP address.

[0012] Optionally, after configuring the subnet mask of the target communication module according to the mask configuration mode, the method further includes: creating a DHCP service process within the target communication module; and using the DHCP service process to configure cellular network card information for the host computer of the target communication module, wherein the cellular network card information includes an IP address and the subnet mask.

[0013] According to another embodiment of the present invention, a subnet mask configuration apparatus is provided, comprising: a sending module for sending a Packet Data Network (PDN) dialing request to a network end; a parsing module for parsing a mask configuration mode of a target communication module after successful PDN activation, wherein the mask configuration mode is used to indicate the method for obtaining the WAN port mask of the target communication module; and a first configuration module for configuring the subnet mask of the target communication module according to the mask configuration mode.

[0014] Optionally, the device further includes: a detection module, configured to detect a user configuration request via the host computer of the target communication module before the parsing module parses the mask configuration mode of the target communication module; a generation module, configured to respond to the user configuration request and generate a mask configuration instruction for the target communication module based on the user configuration request; and a second configuration module, configured to configure the mask configuration mode of the target communication module using the mask configuration instruction.

[0015] Optionally, the second configuration module includes: a positioning unit, configured to locate the nv configuration file in the configuration information of the target communication module; and a configuration unit, configured to configure the dhcp_subnetmask_calc parameter of the nv configuration file using the mask configuration instruction to configure the mask configuration mode of the target communication module.

[0016] Optionally, the parsing module includes: a first reading unit for reading the target communication module mask configuration parameters; a second reading unit for reading the field value of a specified field in the mask configuration parameters; and a search unit for searching in a preset mapping table for a mask configuration pattern that matches the field value.

[0017] Optionally, the lookup unit includes: a first lookup subunit, configured to, if the field value is a first field value, look up a first mask configuration pattern matching the first field value in a preset mapping table, wherein the first mask configuration pattern is used to indicate that a subnet mask is calculated based on an IP address; a second lookup subunit, configured to, if the field value is a second field value, look up a second mask configuration pattern matching the second field value in a preset mapping table, wherein the second mask configuration pattern is used to indicate that a subnet mask is calculated based on the class of the IP address; and a third lookup subunit, configured to, if the field value is a third field value, look up a third mask configuration pattern matching the third field value in a preset mapping table, wherein the third mask configuration pattern is used to indicate that a static mask address is used.

[0018] Optionally, the first configuration module includes: an acquisition unit, configured to acquire the IP address of the target communication module; and a creation unit, configured to create a dnsmasq process within the target communication module, and use the dnsmasq process to configure the subnet mask of the Dynamic Host Configuration Protocol (DHCP) of the target communication module based on the mask configuration mode and the IP address.

[0019] Optionally, the apparatus further includes: a creation module, configured to create a DHCP service process within the target communication module after the first configuration module configures the subnet mask of the target communication module according to the mask configuration mode; and a configuration module, configured to configure cellular network card information for the host computer of the target communication module using the DHCP service process, wherein the cellular network card information includes an IP address and the subnet mask.

[0020] According to yet another embodiment of the present invention, a storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to execute the steps in any of the above-described apparatus embodiments when running.

[0021] According to yet another embodiment of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above-described device embodiments.

[0022] Through this embodiment of the invention, a Packet Data Network (PDN) dialing request is sent to the network end. After successful PDN activation, the mask configuration mode of the target communication module is parsed. The mask configuration mode indicates the method for obtaining the WAN port mask of the target communication module. The subnet mask of the target communication module is configured according to the mask configuration mode. By parsing the mask configuration mode of the target communication module after successful PDN activation, the subnet mask can be dynamically configured according to the mask configuration mode. This solves the technical problem of the single subnet mask configuration method in related technologies. Different subnet mask configuration methods are available for users to choose from, ensuring that data services can be performed normally after dialing in different network environments. It also solves the problems of ping failures under different settings in private network environments and the inability to obtain IP addresses under multiple modules of the same device, thus improving the compatibility of the communication module in different network environments. Attached Figure Description

[0023] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0024] Figure 1This is a hardware structure block diagram of a communication module according to an embodiment of the present invention;

[0025] Figure 2 This is a flowchart of a subnet mask configuration method according to an embodiment of the present invention;

[0026] Figure 3 This is a flowchart illustrating the configuration of the subnet mask according to an embodiment of the present invention;

[0027] Figure 4 This is a structural block diagram of a subnet mask configuration device according to an embodiment of the present invention. Detailed Implementation

[0028] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present application. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of the present application can be combined with each other.

[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0030] Example 1

[0031] The method embodiment provided in Embodiment 1 of this application can be executed in a communication module, computer, smart car, smartwatch, shared bicycle, smart cabinet, or similar computing device. Taking its operation on a communication module as an example, Figure 1 This is a hardware structure block diagram of a communication module according to an embodiment of the present invention. Figure 1 As shown, the communication module may include one or more ( Figure 1Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. Optionally, the communication module may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the communication module described above. For example, the communication module may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0032] The memory 104 can be used to store communication module programs, such as application software programs and modules, like the communication module program corresponding to a subnet mask configuration method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the communication module program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the communication module via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0033] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication module's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0034] This embodiment provides a method for configuring a subnet mask. Figure 2 This is a flowchart of a subnet mask configuration method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:

[0035] Step S202: Send a Packet Data Network (PDN) dialing request to the network end;

[0036] In this embodiment, the PDN (Packet Data Network) dialing request is the trigger request for the dialing process, which refers to the process of a mobile device connecting to the Internet through a wireless network. The PDN dialing process includes:

[0037] When a user turns on the Mobile Data Network (MDN) switch, the phone sends a request to the network to connect to the internet.

[0038] After receiving the request, the network sends an APN (Access Point Name) configuration file to the mobile phone. An APN is the name of a network access point used to identify the network type and service provider. Upon receiving the APN configuration file, the communication module establishes a connection with the network based on the information in the file. The communication module then sends a PDP (Packet Data Protocol) request to the network. PDP is a protocol used to transmit data packets in mobile networks. Upon receiving the PDP request, the network assigns an IP address to the mobile phone. An IP address is a unique identifier used to identify the device on the internet. After receiving the IP address, the communication module configures network parameters such as the subnet mask and can then access the internet.

[0039] Step S204: After PDN activation is successful, parse the mask configuration mode of the target communication module, wherein the mask configuration mode is used to indicate the method of obtaining the WAN port mask of the target communication module.

[0040] Step S206: Configure the subnet mask of the target communication module according to the mask configuration mode.

[0041] Through the above steps, a Packet Data Network (PDN) dial-up request is sent to the network. After successful PDN activation, the mask configuration mode of the target communication module is parsed. The mask configuration mode indicates how to obtain the WAN port mask of the target communication module. The subnet mask of the target communication module is configured according to the mask configuration mode. After successful PDN activation, the subnet mask can be dynamically configured according to the mask configuration mode, which solves the technical problem of the single subnet mask configuration method in related technologies. Different subnet mask configuration methods are available for users to choose from, ensuring that data services can be performed normally after dialing in different network environments. It solves the problems of ping failures between different settings in private network environments and the inability to obtain IP addresses for multiple modules of the same device, thus improving the compatibility of the communication module in different network environments.

[0042] In this embodiment, before parsing the mask configuration mode of the target communication module, the following steps are also included:

[0043] S11, the host computer of the target communication module detects the user configuration request;

[0044] Users input a configuration request on the host computer based on the network environment and actual needs, triggering the configuration process.

[0045] S12, respond to the user configuration request and generate a mask configuration instruction for the target communication module based on the user configuration request;

[0046] S13, use the mask configuration instruction to configure the mask configuration mode of the target communication module.

[0047] Optionally, configuring the target communication module's mask configuration mode using mask configuration instructions includes: locating the nv configuration file in the target communication module's configuration information; and configuring the dhcp_subnetmask_calc parameter of the nv configuration file using mask configuration instructions to configure the target communication module's mask configuration mode.

[0048] Optionally, the mask configuration command is GTNETMASK, and the path to dhcp_subnetmask_calc is modem / nv / item_files / modem / data / protocols / dhcp_subnetmask_calc. dhcp_subnetmask_calc is a parameter used to calculate the DHCP subnet mask. DHCP (Dynamic Host Configuration Protocol) is a network protocol used to automatically assign IP addresses and other network configuration information to devices. In DHCP, the subnet mask is used to determine the number of hosts and subnets in the network. The dhcp_subnetmask_calc parameter is used to calculate the subnet mask that the DHCP server should assign to the client. In this embodiment, the following parameters are required:

[0049] IP address: The IP address of the DHCP server;

[0050] Subnet mask bit width: Used to specify the number of bits in the subnet mask, for example, 24 bits represents 255.255.255.0;

[0051] Number of subnets: Specifies the number of subnets in the network;

[0052] Mask configuration mode: Used to indicate the method for obtaining the WAN port mask of the target communication module;

[0053] Using the parameters mentioned above, dhcp_subnetmask_calc can calculate the correct subnet mask to ensure that all devices in the network can communicate correctly.

[0054] This embodiment develops AT+GTNETMASK to configure the WAN subnet mask. By configuring the modem / nv / item_files / modem / data / protocols / dhcp_subnetmask_calc parameter, the function of dynamically allocating the WAN subnet mask after dialing is realized.

[0055] In one embodiment of this example, parsing the mask configuration pattern of the target communication module includes: reading the mask configuration parameters of the target communication module; reading the field value of a specified field in the mask configuration parameters; and searching for a mask configuration pattern that matches the field value in a preset mapping table.

[0056] In one example, the communication module sends an AT to configure the WAN subnet mask. If AT+GTNETMASK = 1, it is calculated based on the IP address; if AT+GTNETMASK = 2, it is calculated based on the IP address classification; if AT+GTNETMASK = 3, "255.255.255.0", the fixed WAN subnet mask is 255.255.255.0.

[0057] Optionally, searching for a mask configuration pattern matching the field value in the preset mapping table includes: if the field value is a first field value, searching for a first mask configuration pattern matching the first field value in the preset mapping table, wherein the first mask configuration pattern is used to indicate that the subnet mask is calculated based on the IP address; if the field value is a second field value, searching for a second mask configuration pattern matching the second field value in the preset mapping table, wherein the second mask configuration pattern is used to indicate that the subnet mask is calculated based on the class of the IP address; if the field value is a third field value, searching for a third mask configuration pattern matching the third field value in the preset mapping table, wherein the third mask configuration pattern is used to indicate that a static mask address is used.

[0058] In this embodiment, configuring the subnet mask of the target communication module according to the mask configuration mode includes: obtaining the IP address of the target communication module; creating a dnsmasq process within the target communication module; and using the dnsmasq process to configure the subnet mask of the target communication module's Dynamic Host Configuration Protocol (DHCP) based on the mask configuration mode and the IP address.

[0059] The module internally configures the DHCP subnet mask with the appropriate subnet mask by using dnsmasq, thereby preventing the host computer from being unable to obtain an IP address when there are multiple modules.

[0060] In one example, the module's WAN port obtains the corresponding IP address, subnet mask, and gateway address from the base station. The gateway address is calculated as follows: if the address obtained by adding 1 to the IP address is the broadcast address of that subnet, then the IP address minus 1 is used as the gateway address; otherwise, the IP address plus 1 is used. The subnet mask is calculated by setting all leading 1s and all trailing 0s to the positions where changes occur in the binary representation of the IP address. An example is shown below:

[0061] IP=192.168.200.72(1100 0000 1010 1000 1100 1000 0100 1000)

[0062] netmask=255.255.255.240(1111 11111111 1111 1111 111111110000)

[0063] gwip=192.168.200.73(1100 0000 1010 1000 1100 1000 0100 1001)

[0064] IP=192.168.200.73(1100 0000 1010 1000 1100 1000 0100 1001)

[0065] netmask=255.255.255.252(1111 1111 1111 1111 1111 1111 11111100)

[0066] gwip=192.168.200.74(1100 0000 1010 1000 1100 1000 0100 1010).

[0067] In one example, configuring the subnet mask of the Dynamic Host Configuration Protocol (DHCP) for the target communication module based on the mask configuration mode and IP address includes: obtaining the IP address; resolving the class of the IP address; finding the second subnet mask of the IP address based on the class; and configuring the second subnet mask as the subnet mask of the IP address.

[0068] There are three classes: A, B, and C. Subnet masks are dynamically assigned based on the class of the IP address. The subnet mask for a Class A IP address is 255.0.0.0, the subnet mask for a Class B IP address is 255.255.0.0, and the subnet mask for a Class C IP address is 255.255.255.0.

[0069] In one example, the subnet mask for the Dynamic Host Configuration Protocol (DHCP) that configures the target communication module based on the mask configuration mode and IP address includes: obtaining an IP address; obtaining a fixed static subnet mask; and configuring the static subnet mask as the subnet mask of the IP address.

[0070] When a static subnet mask is set, the WAN subnet mask will be the set static subnet mask after dialing.

[0071] The solution in this embodiment allows for selective configuration of the WAN port subnet mask based on the actual network conditions. This can be configured by issuing the relevant AT (Automatic Address Translation) before dialing. Depending on the situation, the AT can be configured in three ways: 1. Calculate the corresponding subnet mask based on the IP address; 2. Dynamically assign the subnet mask based on the IP address category: Class A IP addresses use a subnet mask of 255.0.0.0, Class B IP addresses use 255.255.0.0, and Class C IP addresses use 255.255.255.0; 3. Set a static subnet mask, which will be used after dialing.

[0072] Optionally, after configuring the subnet mask of the target communication module according to the mask configuration mode, the method further includes: creating a DHCP service process within the target communication module; and using the DHCP service process to configure cellular network card information for the host computer of the target communication module, wherein the cellular network card information includes IP address and subnet mask.

[0073] In Qualcomm platform applications, the netmgr configures the rmnet_data network interface card (NIC) information, enabling data services through this NIC. Internally, the module acts as a DHCP server, assigning appropriate IP addresses and netmasks to the host computer, thus achieving configurable WAN subnet mask functionality.

[0074] Figure 3 This is a flowchart illustrating the configuration of the subnet mask according to an embodiment of the present invention, including:

[0075] (1) Configure different WAN mask acquisition methods according to different network environment requirements. They can be configured into three modes: calculated based on IP address, calculated based on IP address class, and static mask address.

[0076] (2) Initiate a PDN dialing request. After successful activation, send the corresponding IP and netmsk information according to the WAN mask acquisition method.

[0077] (3) Configure the rmnet_data network card information in netmgr, which can be used for data services. The module internally acts as a DHCP server to assign corresponding IP addresses, netmasks, etc. to the host computer, thereby realizing the configurable WAN port subnet mask.

[0078] This embodiment addresses the challenge of a single WAN subnet mask calculation scheme in multi-scenario applications. It offers a set of selectable calculation schemes to ensure normal data service functionality after dialing in various network environments. Specifically, it resolves issues such as ping failures under different settings in private network environments and the inability to obtain IP addresses with multiple modules, significantly improving the compatibility of the communication module across different network environments. It enables normal data service operation after dialing in different network environments and allows for flexible configuration of the mask calculation method based on different network conditions, enhancing the compatibility and competitiveness of the communication module.

[0079] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0080] Example 2

[0081] This embodiment also provides a subnet mask configuration device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0082] Figure 4 This is a structural block diagram of a subnet mask configuration device according to an embodiment of the present invention, such as... Figure 4 As shown, the device includes:

[0083] Sending module 40 is used to send a Packet Data Network (PDN) dialing request to the network end;

[0084] The parsing module 42 is used to parse the mask configuration mode of the target communication module after the PDN is successfully activated, wherein the mask configuration mode is used to indicate the method of obtaining the WAN port mask of the target communication module;

[0085] The first configuration module 44 is used to configure the subnet mask of the target communication module according to the mask configuration mode.

[0086] Optionally, the device further includes: a detection module, configured to detect a user configuration request via the host computer of the target communication module before the parsing module parses the mask configuration mode of the target communication module; a generation module, configured to respond to the user configuration request and generate a mask configuration instruction for the target communication module based on the user configuration request; and a second configuration module, configured to configure the mask configuration mode of the target communication module using the mask configuration instruction.

[0087] Optionally, the second configuration module includes: a positioning unit, configured to locate the nv configuration file in the configuration information of the target communication module; and a configuration unit, configured to configure the dhcp_subnetmask_calc parameter of the nv configuration file using the mask configuration instruction to configure the mask configuration mode of the target communication module.

[0088] Optionally, the parsing module includes: a first reading unit for reading the target communication module mask configuration parameters; a second reading unit for reading the field value of a specified field in the mask configuration parameters; and a search unit for searching in a preset mapping table for a mask configuration pattern that matches the field value.

[0089] Optionally, the lookup unit includes: a first lookup subunit, configured to, if the field value is a first field value, look up a first mask configuration pattern matching the first field value in a preset mapping table, wherein the first mask configuration pattern is used to indicate that a subnet mask is calculated based on an IP address; a second lookup subunit, configured to, if the field value is a second field value, look up a second mask configuration pattern matching the second field value in a preset mapping table, wherein the second mask configuration pattern is used to indicate that a subnet mask is calculated based on the class of the IP address; and a third lookup subunit, configured to, if the field value is a third field value, look up a third mask configuration pattern matching the third field value in a preset mapping table, wherein the third mask configuration pattern is used to indicate that a static mask address is used.

[0090] Optionally, the first configuration module includes: an acquisition unit, configured to acquire the IP address of the target communication module; and a creation unit, configured to create a dnsmasq process within the target communication module, and use the dnsmasq process to configure the subnet mask of the Dynamic Host Configuration Protocol (DHCP) of the target communication module based on the mask configuration mode and the IP address.

[0091] Optionally, the apparatus further includes: a creation module, configured to create a DHCP service process within the target communication module after the first configuration module configures the subnet mask of the target communication module according to the mask configuration mode; and a configuration module, configured to configure cellular network card information for the host computer of the target communication module using the DHCP service process, wherein the cellular network card information includes an IP address and the subnet mask.

[0092] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0093] Example 3

[0094] Embodiments of the present invention also provide a storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.

[0095] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:

[0096] S1, send a Packet Data Network (PDN) dialing request to the network end;

[0097] S2, After PDN is successfully activated, the mask configuration mode of the target communication module is parsed, wherein the mask configuration mode is used to indicate the method of obtaining the WAN port mask of the target communication module;

[0098] S3, Configure the subnet mask of the target communication module according to the mask configuration mode.

[0099] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0100] Embodiments of the present invention also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0101] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0102] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0103] S1, send a Packet Data Network (PDN) dialing request to the network end;

[0104] S2, After PDN is successfully activated, the mask configuration mode of the target communication module is parsed, wherein the mask configuration mode is used to indicate the method of obtaining the WAN port mask of the target communication module;

[0105] S3, Configure the subnet mask of the target communication module according to the mask configuration mode.

[0106] The electronic device provided in this application embodiment can specifically be a module capable of communication functions or a terminal device containing such a module. The terminal device can be a mobile terminal or a smart terminal. Specifically, a mobile terminal can be at least one of a mobile phone, tablet computer, or laptop computer; a smart terminal can specifically be a smart car, smartwatch, shared bicycle, smart cabinet, or other terminal containing a wireless communication module; and the module can specifically be a wireless communication module, such as any one of a 2G communication module, 3G communication module, 4G communication module, 5G communication module, or NB-IoT communication module.

[0107] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0108] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0109] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0110] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0111] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0112] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0113] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0114] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for configuring a subnet mask, characterized in that, include: Send a Packet Data Network (PDN) dialing request to the network end; After successful PDN activation, the mask configuration mode of the target communication module is parsed. The mask configuration mode is used to indicate the method of obtaining the WAN port mask of the target communication module. The mask configuration mode package includes a first mask configuration mode, a second mask configuration mode, and a third mask configuration mode. The first mask configuration mode is used to indicate the calculation of the subnet mask based on the IP address. The second mask configuration mode is used to indicate the calculation of the subnet mask based on the class of the IP address. The third mask configuration mode is used to indicate the use of a static mask address. Configure the subnet mask of the target communication module according to the mask configuration mode; Before parsing the mask configuration mode of the target communication module, the method further includes: detecting a user configuration request through the host computer of the target communication module; responding to the user configuration request and generating a mask configuration instruction for the target communication module based on the user configuration request; and configuring the mask configuration mode of the target communication module using the mask configuration instruction. The process of configuring the subnet mask of the target communication module according to the mask configuration mode includes: obtaining the IP address of the target communication module; creating a dnsmasq process within the target communication module; and using the dnsmasq process to configure the subnet mask of the target communication module's Dynamic Host Configuration Protocol (DHCP) based on the mask configuration mode and the IP address.

2. The method according to claim 1, characterized in that, Configuring the target communication module mask configuration mode using the mask configuration command includes: Locate the nv configuration file in the configuration information of the target communication module; The mask configuration instruction is used to configure the dhcp_subnetmask_calc parameter in the nv configuration file to configure the target communication module mask configuration mode.

3. The method according to claim 1, characterized in that, The mask configuration modes for parsing the target communication module include: Read the target communication module mask configuration parameters; Read the value of the specified field in the mask configuration parameters; Search the preset mapping table for a mask configuration pattern that matches the field value.

4. The method according to claim 3, characterized in that, The process of finding a mask configuration pattern that matches the field value in the preset mapping table includes: If the field value is the first field value, search for a first mask configuration pattern that matches the first field value in a preset mapping table, wherein the first mask configuration pattern is used to indicate the calculation of the subnet mask based on the IP address; If the field value is the second field value, search for a second mask configuration pattern that matches the second field value in the preset mapping table, wherein the second mask configuration pattern is used to indicate the calculation of the subnet mask according to the category to which the IP address belongs; If the value of the field is a third field value, a third mask configuration pattern that matches the third field value is searched in a preset mapping table, wherein the third mask configuration pattern is used to indicate the use of a static mask address.

5. The method according to claim 1, characterized in that, After configuring the subnet mask of the target communication module according to the mask configuration mode, the method further includes: Create a DHCP service process within the target communication module; The DHCP service process is used to configure cellular network card information for the host computer of the target communication module, wherein the cellular network card information includes the IP address and the subnet mask.

6. A subnet mask configuration device, characterized in that, include: The sending module is used to send packet data network (PDN) dialing requests to the network end; The parsing module is used to parse the mask configuration mode of the target communication module after successful PDN activation. The mask configuration mode indicates the method for obtaining the WAN port mask of the target communication module. The mask configuration mode package includes a first mask configuration mode, a second mask configuration mode, and a third mask configuration mode. The first mask configuration mode indicates that the subnet mask is calculated based on the IP address; the second mask configuration mode indicates that the subnet mask is calculated based on the class of the IP address; and the third mask configuration mode indicates that a static mask address is used. The first configuration module is used to configure the subnet mask of the target communication module according to the mask configuration mode; The device further includes: a detection module, used to detect a user configuration request through the host computer of the target communication module before the parsing module parses the mask configuration mode of the target communication module; a generation module, used to respond to the user configuration request and generate a mask configuration instruction for the target communication module based on the user configuration request; and a second configuration module, used to configure the mask configuration mode of the target communication module using the mask configuration instruction. The first configuration module includes: an acquisition unit for acquiring the IP address of the target communication module; and a creation unit for creating a dnsmasq process within the target communication module and using the dnsmasq process to configure the subnet mask of the Dynamic Host Configuration Protocol (DHCP) of the target communication module based on the mask configuration mode and the IP address.

7. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 5 when it is run.

8. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method as described in any one of claims 1 to 5.