An Android system-based multi-link network aggregation method and device, and a storage medium
By installing an app on the Android system to generate a virtual network port tun0, modifying the routing table, and allocating data packets to different links, the problem of Android systems being unable to achieve multi-link concurrency was solved, achieving bandwidth aggregation and improving the phone's network performance.
Patent Information
- Application Number
- CN202211732736.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2042-12-30
AI Technical Summary
The existing Android system cannot achieve concurrency of multiple network links, resulting in the inability to aggregate bandwidth. The existing multi-network acceleration function cannot use multiple networks to aggregate bandwidth at the same time.
By installing an app on the Android system, a virtual network port tun0 is generated, the routing table is modified, and the VPN class inherits from VpnService to allocate data packets to different communication links according to the link communication quality, thus realizing multi-link network aggregation.
In high-bandwidth application scenarios, it significantly improves the uplink and downlink speeds of mobile phones and rationally allocates the load according to the real-time network conditions, thereby improving network stability.
Smart Images

Figure CN116156568B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of network multi-link aggregation, in particular to a software implementation method based on multi-link network aggregation under an Android system. BACKGROUND
[0002] At present, there are three ways for the Android system to access the Internet, one is through a mobile cellular network (through a 2G / 3G / 4G / 5G module), one is a WiFi network (through a 2.4G / 5G band WiFi chip), and the other is through a wired network (the device itself has a wired network port or through an external typc-c / micro-usb to wired network port). The Android system itself has an official set of scoring mechanisms for the above networks, and the system will select the network with the highest score as the system network according to the current network situation. Generally speaking, the wired network has the highest score, followed by WiFi, and finally the mobile cellular network. At the same time, Android can only select one network to connect to the Internet. The native Android system can only use one network at the same time, and cannot achieve multi-link concurrency. For example, when browsing a webpage on a mobile phone, after connecting to WiFi, the system automatically switches the network from "mobile data" to WiFi.
[0003] To solve this problem, people have found a multi-link aggregation method: it can simultaneously use two or more of the 2G / 3G / 4G / 5G network, WiFi and wired network to achieve multi-link network aggregation, which is specifically manifested as the superposition effect of the uplink and downlink bandwidth of the network. However, at present, the multi-network acceleration function on domestic mobile phones cannot achieve bandwidth superposition. At the same time, only one of the mobile network / WiFi / wired network can be used, and only when the currently used network is not good, the other network on the mobile phone will be used as a replacement, which is not a true sense of bandwidth superposition "acceleration". Through mobile phone speed testing, it can be seen that there is no link aggregation. The existing aggregation technology has not found a way to achieve link aggregation by installing an APP (application) on the native Android system. SUMMARY
[0004] The purpose of the present application is to achieve multi-link network aggregation by installing an APP on the Android system. The technical solution adopted by the present application is:
[0005] The present application provides a multi-link network aggregation method based on an Android system, comprising:
[0006] Obtain the IP state of all network ports and loop through the IP information of all network ports;
[0007] Generate a virtual network port tun0 and modify the routing table;
[0008] The aggregation client subprogram acquires the data packet, processes the data packet according to the IP status of all the network interfaces;
[0009] The aggregation client subprogram judges the link communication quality according to the IP information of all the network interfaces acquired through the loop;
[0010] According to the link communication quality, the aggregation client subprogram distributes the processed data packet to different communication links.
[0011] Further, the step of acquiring the IP information of all the network interfaces through the loop comprises: if the IP of the mobile network is cleared by the Android system, the cleared IP of the mobile network is automatically restored.
[0012] Further, the step of generating the virtual network interface tun0 and modifying the routing table comprises:
[0013] A new VPN class is created, and the VPN class inherits from the VpnService of the Android system;
[0014] A special route is set, and the routing table in the Kernel layer is modified.
[0015] Further, the step of the aggregation client subprogram judging the link communication quality according to the IP information of all the network interfaces acquired through the loop comprises:
[0016] A bandwidth monitoring packet is sent to the aggregation server, and the sending bandwidth of each communication link is recorded;
[0017] The receiving bandwidth of each communication link is received, and the bandwidth change rate of each communication link is determined according to the sending bandwidth and the receiving bandwidth;
[0018] The link for sending the data packet is determined according to the size of the bandwidth change rate of each communication link.
[0019] Further, the step of the aggregation client subprogram distributing the processed data packet to different communication links according to the link communication quality comprises sending data to the external network and accepting data from the external network; the step of sending data to the external network comprises:
[0020] The application layer sends the unprocessed data packet;
[0021] After the data packet passes through the Framework layer and the HAL layer, the data packet is diverted to the virtual network interface tun0;
[0022] The virtual network interface tun0 sends the data packet to the aggregation program, and the aggregation program performs slicing processing on the processed data packet;
[0023] The aggregated client subprogram sends the data packet after slicing to the aggregated server through a real link;
[0024] The aggregated server performs packet assembling on the data packet after slicing.
[0025] Further, the step of receiving data from the external network comprises:
[0026] The aggregated client subprogram sends the data from the external network to the aggregated program through a real link;
[0027] The aggregated client subprogram performs packet assembling on the data;
[0028] The aggregated client subprogram sends the data packet after packet assembling to the virtual network interface tun0;
[0029] The virtual network interface tun0 sends the data packet after packet assembling to the application layer; the data packet passes through the Framework layer and the HAL layer before being diverted to the virtual network interface tun0.
[0030] Further, the IP status of all network interfaces comprises the IP status of a communication link, the IP status of an aggregated server, and the IP status of a virtual network interface tun0.
[0031] Further, the communication link comprises a 2G network, a 3G network, a 4G network, a 5G network, a 2.4G WiFi, a 5G WiFi, and a wired network.
[0032] In another aspect, the present application also provides a computer device, characterized by comprising a memory and a processor, wherein the memory is used to store at least one program, and the processor is used to load the at least one program to execute any one of the multi-link network aggregation methods based on an Android system.
[0033] In another aspect, the present application also provides a computer readable storage medium, wherein a program executable by a processor is stored, and the program executable by the processor is used to execute any one of the multi-link network aggregation methods based on an Android system when executed by the processor.
[0034] The present application has the beneficial effect that when a mobile phone is in a high-bandwidth application scenario, such as live streaming or downloading a large file, the uplink and downlink rates of the mobile phone can be obviously improved, and the effect of superimposing link bandwidth is achieved, and according to the real-time situation of the network, the load is reasonably distributed to different links according to the weight, thereby improving the stability of the mobile phone network. BRIEF DESCRIPTION OF DRAWINGS
[0035] Figure 1 Network flow direction for APP data transmission of the embodiment of the present application;
[0036] Figure 2 Network flow direction for APP data receiving of the embodiment of the application. DETAILED DESCRIPTION
[0037] The application will be further described below in conjunction with the accompanying drawings and specific embodiments. The described embodiments should not be regarded as limiting the application, and all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of the application.
[0038] In the following description, "some embodiments" are related to a subset of all possible embodiments, but it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.
[0039] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the application belongs. The terms used herein are only for the purpose of describing the embodiments of the application and are not intended to limit the application.
[0040] There are currently three main ways to access the Internet on Android systems: one is through mobile cellular networks (through 2G / 3G / 4G / 5G modules), one is through WiFi networks (through 2.4G / 5G band WiFi chips), and the other is through wired networks (devices themselves have wired network ports or through external typc-c / micro-usb to wired network ports). Android system itself has an official set of scoring mechanisms for the above networks, and the system will select the network with the highest score as the system network according to the current network situation. Generally speaking, wired networks have the highest score, followed by WiFi, and finally mobile cellular networks. At the same time, Android systems can only select one network to connect to the Internet and cannot achieve multi-link concurrency. For example, when browsing the web, the system automatically switches the network from "mobile data" to WiFi after connecting to WiFi.
[0041] Currently, the multi-network acceleration function on domestic mobile phones cannot achieve bandwidth stacking. At the same time, only one of the mobile network / WiFi / wired network can be used, and only when the current network is not good, the other network on the phone can be used as a replacement, which is not a true sense of bandwidth stacking "acceleration". Through mobile phone speed testing, it can be seen that there is no link stacking.
[0042] Existing aggregation technologies have not found a way to achieve link aggregation through the installation of APPs (applications) on the original Android system.
[0043] The main problem solved by the embodiment of the present application is: realizing multi-link network aggregation by installing APP on an Android system. When a mobile phone is in a high-bandwidth application scenario, such as live broadcast or downloading a large file, the uplink and downlink rates of the mobile phone can be obviously improved, the effect of link bandwidth superposition is achieved, and according to the real-time situation of the network, the load is reasonably distributed to different links according to the weight, thereby improving the stability of the mobile phone network.
[0044] Multi-link aggregation: two or more of 2G / 3G / 4G / 5G network, WiFi and wired network can be used at the same time, multi-link network aggregation is realized, and the specific performance is that the uplink and downlink bandwidth of the network has the effect of superposition.
[0045] In the embodiment scheme of the present application, the subprogram part of the aggregation APP is obtained by modifying the VpnServive class provided by the Android SDK.
[0046] The interaction between the data packet of the ordinary Android APP and the external network is that the flow direction of the data packet includes:
[0047] When the data packet is sent from the application layer: application layer-->Framework layer-->HAL layer-->Kernel layer-->real network port-->external network;
[0048] When the application layer receives external network data: external network-->real network port-->Kernel layer-->HAL layer-->Framework layer->application layer.
[0049] After starting the VpnService, the Android system generates a virtual network port tun, and sets a routing rule in the Kernel layer, so that the data originally to the real network port is diverted to the virtual network port device tun. After the program processes the data from the tun port in the Framework layer, the data is transmitted to the actual network port for sending. The link of the application layer receiving data is also similar, that is, after processing in the Framework layer, the data is diverted to the tun port in the Kernel layer, and finally transmitted to the application layer. After starting the VpnService, the flow direction of the data packet is changed as follows:
[0050] When the data packet is sent from the application layer: application layer-->Framework layer-->HAL layer-->Kernel layer-->virtual network port (tun)-->HAL layer-->Framework layer (VPN program processing)-->HAL layer-->Kernel layer-->actual network port-->external network;
[0051] When the application layer receives the external network data: external network -> actual network port -> Kernel layer -> HAL layer -> Framework layer (VPN program processing) -> HAL layer -> Kernel layer -> virtual network port (tun) -> Kernel layer -> HAL layer -> Framework layer -> application layer.
[0052] The following are actual operation steps in the embodiment of the application:
[0053] S1. Obtain the IP state of all network ports. Loop to obtain the IP information of all network ports. After connecting to WiFi, if the IP of the mobile network is cleared by the Android system, the IP is automatically restored;
[0054] S2. Create a VPN class, which inherits from VpnService;
[0055] S3. In the class of step 2, set a special route so that the IP of the aggregation server does not go through the tun port;
[0056] S4. Encapsulate the aggregation algorithm into an aggregation library for the aggregation program to call;
[0057] S5. Pass the IP of the real link (mobile network port / WiFi / network port), the IP of the tun port to be created by VpnService, and the IP of the aggregation server as parameters into the aggregation library for the aggregation program to call;
[0058] S6. In the VPN class, configure the route between tun0 (a virtual network port generated by the VPN subprogram) and the real link (mobile network port / WiFi / network port). When the IP of the link changes, the route needs to be updated immediately and the parameters need to be passed to the aggregation program;
[0059] S7. Configure the interface and add necessary basic function controls such as "start aggregation" and "stop aggregation" on the UI. Associate the controls with the aggregation subprogram in the back end to facilitate starting and stopping the aggregation program on the interface;
[0060] S8. Compile to generate an APK package.
[0061] In the embodiment of the application, when the aggregation APP is started, VpnService is started, which mainly generates a virtual network port tun0; modifies the routing table in the Kernel layer to divert the data of the application layer to tun0; and processes the data in the Framework layer.
[0062] The network flow direction of the APP data sent in the embodiment of the application is as shown in Figure 1 , and the network flow direction of the APP data received in the embodiment of the application is as shown in Figure 2The data of the APP is sent to the Kernel layer, and then is guided to the tun port, and then is sent to the aggregation program of the framework layer for processing, and then is sent to multiple real links; the data received from the real links outside is first sent to the aggregation program of the framework layer for processing, and then is guided to the tun port in the kernel layer, and then is sent to the APP of the application layer.
[0063] In the embodiment of the application, the setting idea of the virtual routing tun0 port is as follows: assuming that all network IP addresses are a set A, the IP of the aggregation server is a set B, and the set A excluding the IP of the aggregation server is A1. The set A1 is composed of multiple subsets, and the IP address conversion into binary has 32 bits, i.e., A1 can be composed of 32 subsets, each of which and B are Currently, the set A1 needs to be found, and then the IP of A1 is added to the routing.
[0064] The setting method of the routing is as follows:
[0065] The IP of the aggregation server is converted into binary, for example, the IP (such as 39.108.117.187) of the aggregation server is converted into binary as follows: 0010 0111 0110 1100 0111 0101 1011 1011
[0067] The highest bit of the IP of the aggregation server is inverted, and the other bits are 0, and is recorded as IP_1, i.e.: 1000 0000 0000 0000 0000 0000 0000 0000
[0069] The corresponding mask number is 1 bit; the second highest bit of the IP of the aggregation server is inverted, and the third highest bit to the last bit is 0, and is recorded as IP_2, for example: 0100 0000 0000 0000 0000 0000 0000 0000
[0071] The corresponding mask number is 2 bits; in this way, the 32 IPs of IP_1 to IP_32 are found, and the corresponding masks are recorded. The 32 "IPs and the corresponding masks" are added to the routing one by one.
[0072] The technical scheme in the embodiment of the application has the following actual measurement effects: after starting the aggregation App on an Android mobile phone, the mobile phone can normally access the Internet, browse web pages and watch videos. When using a speed test website or speed test software such as speedtest or iperf for testing, it is found that the bandwidth of multiple links can be effectively stacked. When the mobile phone has only a mobile network, starting the aggregation App enables the mobile phone to normally access the Internet, but there is no stacking effect. Then, the WiFi is connected, the aggregation App automatically adds the WiFi link to the aggregation link, and in this environment, the speed is tested again, and the bandwidth has a significant stacking effect.
[0073] The above is a specific description of the preferred embodiments of the application, but the application is not limited to the described embodiments. Those skilled in the art can make various equivalent modifications or replacements without departing from the spirit of the application. These equivalent modifications or replacements are all included in the scope defined by the claims of the application.
Claims
1. A method for multi-link network aggregation based on an Android system, characterized in that, The method comprises the following steps: acquiring IP states of all network interfaces and acquiring IP information of all network interfaces cyclically; generating a virtual network interface tun0 and modifying a routing table; an aggregation client subprogram acquires data packets and processes the data packets according to the IP states of all network interfaces; the aggregation client subprogram judges link communication quality according to the IP information of all network interfaces acquired cyclically; the aggregation client subprogram distributes the processed data packets to different communication links according to the link communication quality; the step of acquiring the IP information of all network interfaces cyclically comprises the following step: if an IP of a mobile network is cleared by an Android system, the cleared IP of the mobile network is automatically restored.
2. The multi-link network aggregation method based on an Android system according to claim 1, characterized in that, the step of generating the virtual network interface tun0 and modifying the routing table comprises the following steps: a VPN class is newly created, and the VPN class inherits from a VpnService of the Android system; a special route is set, and a routing table located in a Kernel layer is modified.
3. The method of claim 1, wherein, the step of the aggregation client subprogram judging the link communication quality according to the IP information of all network interfaces acquired cyclically comprises the following steps: a bandwidth monitoring packet is sent to an aggregation server, and a sending bandwidth of each communication link is recorded; a receiving bandwidth of each communication link is received, and a bandwidth change rate of each communication link is determined according to the sending bandwidth and the receiving bandwidth; a link for sending data packets is determined according to the bandwidth change rate of each communication link.
4. The multi-link network aggregation method based on an Android system according to claim 1, characterized in that, the step of the aggregation client subprogram distributing the processed data packets to different communication links according to the link communication quality comprises the following steps of sending data to an external network and receiving data from the external network. the step of sending data to the external network comprises the following steps: an application layer sends unprocessed data packets; the data packets are guided to the virtual network interface tun0 after passing through a Framework layer and a HAL layer; the virtual network interface tun0 sends the data packets to an aggregation program, and the aggregation program performs slicing processing on the processed data packets; the aggregation client subprogram sends the sliced data packets to the aggregation server through a real link; the aggregation server performs packet assembling processing on the sliced data packets.
5. The multi-link network aggregation method based on an Android system according to claim 4, characterized in that, the step of receiving data from the external network comprises the following steps: the aggregation client subprogram sends external network data to the aggregation program through a real link; the aggregation client subprogram performs packet assembling processing on the data; the aggregation client subprogram sends the packet assembled data packets to the virtual network interface tun0; the virtual network interface tun0 sends the packet assembled data packets to an application layer; the data packets pass through a Framework layer and a HAL layer before being guided to the virtual network interface tun0.
6. The multi-link network aggregation method based on an Android system according to claim 1, characterized in that, the IP states of all network interfaces comprise communication link IP states, aggregation server IP states and virtual network interface tun0 IP states.
7. The method of claim 1, wherein, the communication links comprise 2G networks, 3G networks, 4G networks, 5G networks, 2.4G WiFi, 5G WiFi and wired networks.
8. A computer apparatus, comprising: The method comprises a memory and a processor, the memory is used for storing at least one program, and the processor is used for loading the at least one program to execute the multi-link network aggregation method based on the Android system in any one of claims 1-7.
9. A computer readable storage medium, in which a program executable by a processor is stored, characterized in that, The program executable by the processor, when executed by the processor, is used to execute the multi-link network aggregation method based on the Android system according to any one of claims 1-7.
Citation Information
Patent Citations
Link aggregation device and method based on encrypted mobile communication
CN107979541A