CN113765802A - android device network card dynamic switching method, system, terminal and storage medium - Google Patents

android device network card dynamic switching method, system, terminal and storage medium Download PDF

Info

Publication number
CN113765802A
CN113765802A CN202110843209.4A CN202110843209A CN113765802A CN 113765802 A CN113765802 A CN 113765802A CN 202110843209 A CN202110843209 A CN 202110843209A CN 113765802 A CN113765802 A CN 113765802A
Authority
CN
China
Prior art keywords
network card
function
network
forwarding
route
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110843209.4A
Other languages
Chinese (zh)
Other versions
CN113765802B (en
Inventor
张博昱
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen JWIPC Technology Co Ltd
Original Assignee
Shenzhen JWIPC Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen JWIPC Technology Co Ltd filed Critical Shenzhen JWIPC Technology Co Ltd
Priority to CN202110843209.4A priority Critical patent/CN113765802B/en
Publication of CN113765802A publication Critical patent/CN113765802A/en
Application granted granted Critical
Publication of CN113765802B publication Critical patent/CN113765802B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/54Organization of routing tables

Abstract

The invention relates to a method for dynamically switching network cards of android devices, which comprises the following steps: selecting the function of the network card as a routing forwarding function or a data packet receiving function; carrying out conversion adjustment of the network card state according to the selection result in the first step; by the method, dynamic switching of the network card can be realized, so that the data receiving and transmitting functions and the data forwarding functions of the network card can be more fully exerted, the network card is fully utilized, the functional diversity of a product is improved, and the product value is improved.

Description

android device network card dynamic switching method, system, terminal and storage medium
Technical Field
The invention relates to the technical field of android systems, in particular to a method, a system, a terminal and a storage medium for dynamically switching network cards of android devices.
Background
Currently, android products are widely used in various fields of various industries, such as internet terminals, industrial control system terminals, virtual server client terminals, and the like, and networks are used in these fields. The main network module of the android device is an ethernet network card, and the android device can be connected to an external network through the ethernet network card. However, the network card has a data forwarding function (i.e., routing forwarding) in addition to transmitting/receiving data, but the android device generally uses only one of the functions, i.e., data transmission and reception, and cannot fully exert all functions of the network card.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method for dynamically switching an android device network card, a system for dynamically switching an android device network card, a terminal for dynamically switching an android device network card, and a computer-readable storage medium, aiming at the above-mentioned defects in the prior art.
The technical scheme adopted by the invention for solving the technical problems is as follows:
a method for dynamically switching network cards of android devices is constructed, wherein the method comprises the following steps:
the first step is as follows: selecting the function of the network card as a routing forwarding function or a data packet receiving function;
the second step is that: and carrying out conversion adjustment of the network card state according to the selection result in the first step.
The invention relates to a network card dynamic switching method of an android device, wherein when a route forwarding function is selected, a network card state adjusting method comprises the following steps:
setting an ip address of a network card, creating a routing table, creating a use rule of the routing table, creating a forwarding rule, enabling a forwarding function of the network card, and forwarding a network data packet.
The invention relates to a network card dynamic switching method of an android device, wherein when a data packet receiving function is selected, a network card state adjusting method comprises the following steps:
deleting the route forwarding rule, deleting the route table forwarded by the route, deleting the route table use rule forwarded by the route, closing the network card forwarding function, restarting the network card, and receiving and sending network data packets.
According to the method for dynamically switching the network cards of the android devices, the network card functions are selected through a UI (user interface) in the first step.
A network card dynamic switching system of an android device is used for realizing the network card dynamic switching method of the android device, and comprises a network card function selecting unit and a network card state adjusting unit;
the network card function selection unit is used for selecting the function of the network card as a route forwarding function or a data packet receiving function;
and the network card state adjusting unit is used for carrying out conversion adjustment on the network card state according to the selection result of the network card function selecting unit.
The system for dynamically switching the network card of the android device, disclosed by the invention, has the advantages that when the routing forwarding function is selected, the network card state adjusting unit performs the following operations on the network card: setting an ip address of a network card, creating a routing table, creating a use rule of the routing table, creating a forwarding rule, enabling a forwarding function of the network card, and forwarding a network data packet.
The system for dynamically switching the network card of the android device, disclosed by the invention, comprises a network card state adjusting unit and a network card switching unit, wherein when a data packet receiving function is selected, the network card state adjusting unit performs the following operations on the network card: deleting the route forwarding rule, deleting the route table forwarded by the route, deleting the route table use rule forwarded by the route, closing the network card forwarding function, restarting the network card, and receiving and sending network data packets.
The network card dynamic switching system of the android device, provided by the invention, is characterized in that the selection of the network card function selection unit is realized through a UI (user interface).
A terminal for dynamically switching network cards of android devices comprises a memory, a processor and a computer program which is stored in the memory and can run on the processor, wherein the steps of the method are realized when the processor executes the computer program.
A computer-readable storage medium, in which a computer program is stored, wherein the computer program, when being executed by a processor, carries out the steps of the method as set forth above.
The invention has the beneficial effects that: by the method, dynamic switching of the network card can be realized, so that the data receiving and transmitting functions and the data forwarding functions of the network card can be more fully exerted, the network card is fully utilized, the functional diversity of a product is improved, and the product value is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the present invention will be further described with reference to the accompanying drawings and embodiments, wherein the drawings in the following description are only part of the embodiments of the present invention, and for those skilled in the art, other drawings can be obtained without inventive efforts according to the accompanying drawings:
fig. 1 is a flowchart of a method for dynamically switching network cards of android devices according to a preferred embodiment of the present invention;
fig. 2 is a flowchart of a method for adjusting a routing forwarding function of a dynamic network card switching method of an android device according to a preferred embodiment of the present invention;
FIG. 3 is a flowchart illustrating a packet receiving function adjusting method for dynamically switching network cards of an android device according to a preferred embodiment of the present invention;
fig. 4 is a schematic block diagram of a system for dynamically switching network cards of android devices according to a preferred embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without inventive step, are within the scope of the present invention.
As shown in fig. 1, with reference to fig. 2 and fig. 3, the method for dynamically switching network cards of an android device in the preferred embodiment of the present invention includes the following steps:
s01: selecting the function of the network card as a routing forwarding function or a data packet receiving function;
s02: carrying out conversion adjustment of the network card state according to the selection result in the first step;
by the method, dynamic switching of the network card can be realized, so that the data receiving and transmitting functions and the data forwarding functions of the network card can be more fully exerted, the network card is fully utilized, the functional diversity of a product is improved, and the product value is improved.
Preferably, when the routing forwarding function is selected, the network card status adjusting method is as follows:
s021: setting an ip address of a network card;
the ip address of the network card can be set through the ifconfig instruction, the network card is used as a route, and the ip address is the gateway address at the moment; eg: ifconfig eth0192.168.1.1;
s022: creating a routing table;
a routing table can be created through an ip route add instruction, and a route for forwarding a 4g network and an Ethernet network route are added;
eg: creating a routing table 88, adding a route, and taking forwarding to a 4g network as an example, an ip route add Ethernet network address deveth 0 proto static scan link table 88; ip route add default via 4g module gateway address dev ppp0 protostatic table 88;
s023: creating a routing table usage rule;
the use rule of the routing table can be established through an ip rule add instruction;
eg:
ip rule add from all oif ppp0 lookup 88;
ip rule add from all fwmark 0x10064/0x1ffff lookup 88;
ip rule add from all oif ppp0 lookup 88;
ip rule add from all fwmark 0x64/0x1ffff lookup 88;
ip rule add from all fwmark 0x0/0xffff lookup 88;
s024: creating a forwarding rule;
the forwarding rule can be established through an iptables instruction;
eg:
iptables-tnat-I POSTROUTING-s Ethernet network address-o;
s025: enabling a network card forwarding function;
echo 1>/proc/sys/net/ipv4/ip_forward;
s026: and forwarding the network data packet.
Preferably, when the data packet receiving function is selected, the network card status adjusting method is as follows:
s031: deleting the route forwarding rule;
the data may be encoded by the iptables instruction, eg:
iptables-t nat–F;
s032: deleting the routing table forwarded by the route;
the instruction may be executed via an ip route del instruction, eg:
ip route del Ethernet network address deveth 0 proto static scan link table 88;
ip route del default via 4g module gateway address dev ppp0 protostatic table 88;
s033: deleting the routing table use rule forwarded by the route;
the instruction can be realized by an ip rule del instruction, eg:
ip rule del from all oif ppp0 lookup 88;
ip rule del from all fwmark 0x10064/0x1ffff lookup 88;
ip rule del from all oif ppp0 lookup 88;
ip rule del from all fwmark 0x64/0x1ffff lookup 88;
ip rule del from all fwmark 0x0/0xffff lookup 88;
s034: the forwarding function of the network card is closed;
the method can be implemented by instructions to:
echo 0>/proc/sys/net/ipv4/ip_forward;
s035: restarting the network card;
the method can be implemented by instructions to:
EthernetManager.setEthernetEnabled(false);
EthernetManager.setEthernetEnabled(true);
s036: and receiving and transmitting network data packets.
Of course, it is understood that other existing instruction using modes capable of realizing required functions can be realized, and simple transformation based on the principle belongs to the protection scope of the present application;
preferably, the selection of the network card function in the first step is realized through a UI interface.
A system for dynamically switching network cards of android devices is used for realizing the method for dynamically switching the network cards of the android devices, and comprises a network card function selection unit 1 and a network card state adjustment unit 2 as shown in FIG. 4;
a network card function selecting unit 1, configured to select a network card function as a route forwarding function or a data packet receiving function;
the network card state adjusting unit 2 is used for carrying out conversion adjustment on the network card state according to the selection result of the network card function selecting unit;
by the method, dynamic switching of the network card can be realized, so that the data receiving and transmitting functions and the data forwarding functions of the network card can be more fully exerted, the network card is fully utilized, the functional diversity of a product is improved, and the product value is improved.
Preferably, when the routing forwarding function is selected, the network card state adjusting unit 2 performs the following operations on the network card: setting an ip address of a network card, creating a routing table, creating a use rule of the routing table, creating a forwarding rule, enabling a forwarding function of the network card, and forwarding a network data packet.
Preferably, when the packet receiving function is selected, the network card state adjusting unit 2 performs the following operations on the network card: deleting the route forwarding rule, deleting the route table forwarded by the route, deleting the route table use rule forwarded by the route, closing the network card forwarding function, restarting the network card, and receiving and sending network data packets.
Preferably, the selection of the network card function selecting unit 1 is realized through a UI interface.
A terminal for dynamically switching network cards of android devices comprises a memory, a processor and a computer program which is stored in the memory and can run on the processor, wherein the steps of the method are realized when the processor executes the computer program.
A computer-readable storage medium, in which a computer program is stored, wherein the computer program, when being executed by a processor, carries out the steps of the method as set forth above.
It will be understood that modifications and variations can be made by persons skilled in the art in light of the above teachings and all such modifications and variations are intended to be included within the scope of the invention as defined in the appended claims.

Claims (10)

1. A method for dynamically switching network cards of android devices is characterized by comprising the following steps:
the first step is as follows: selecting the function of the network card as a routing forwarding function or a data packet receiving function;
the second step is that: and carrying out conversion adjustment of the network card state according to the selection result in the first step.
2. The method for dynamically switching the network cards of the android devices according to claim 1, wherein when the routing forwarding function is selected, the method for adjusting the network card status is as follows:
setting an ip address of a network card, creating a routing table, creating a use rule of the routing table, creating a forwarding rule, enabling a forwarding function of the network card, and forwarding a network data packet.
3. The android device network card dynamic switching method of claim 1 or 2, wherein when the packet receiving function is selected, the network card state adjusting method is as follows:
deleting the route forwarding rule, deleting the route table forwarded by the route, deleting the route table use rule forwarded by the route, closing the network card forwarding function, restarting the network card, and receiving and sending network data packets.
4. The android device network card dynamic switching method of claim 1 or 2, wherein the selection of the network card function in the first step is realized through a UI (user interface).
5. A system for dynamically switching network cards of android devices is used for realizing the method for dynamically switching the network cards of the android devices as claimed in any one of claims 1 to 4, and is characterized by comprising a network card function selection unit and a network card state adjustment unit;
the network card function selection unit is used for selecting the function of the network card as a route forwarding function or a data packet receiving function;
and the network card state adjusting unit is used for carrying out conversion adjustment on the network card state according to the selection result of the network card function selecting unit.
6. The system for dynamically switching the network card of the android device of claim 5, wherein when the routing forwarding function is selected, the network card state adjusting unit performs the following operations on the network card: setting an ip address of a network card, creating a routing table, creating a use rule of the routing table, creating a forwarding rule, enabling a forwarding function of the network card, and forwarding a network data packet.
7. The android device network card dynamic switching system of claim 5 or 6, wherein when the packet receiving function is selected, the network card state adjusting unit performs the following operations on the network card: deleting the route forwarding rule, deleting the route table forwarded by the route, deleting the route table use rule forwarded by the route, closing the network card forwarding function, restarting the network card, and receiving and sending network data packets.
8. The android device network card dynamic switching system of claim 5 or 6, wherein the selection of the network card function selecting unit is realized through a UI interface.
9. An android device network card dynamic switching terminal, comprising a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 4 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 4.
CN202110843209.4A 2021-07-26 2021-07-26 android device network card dynamic switching method, system, terminal and storage medium Active CN113765802B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110843209.4A CN113765802B (en) 2021-07-26 2021-07-26 android device network card dynamic switching method, system, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110843209.4A CN113765802B (en) 2021-07-26 2021-07-26 android device network card dynamic switching method, system, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN113765802A true CN113765802A (en) 2021-12-07
CN113765802B CN113765802B (en) 2023-08-08

Family

ID=78788023

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110843209.4A Active CN113765802B (en) 2021-07-26 2021-07-26 android device network card dynamic switching method, system, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN113765802B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103957572A (en) * 2014-05-20 2014-07-30 普天信息技术有限公司 Android-system-based distribution method through multi-network route policy
US20140219280A1 (en) * 2013-01-02 2014-08-07 Acceleration Systems, LLC Systems and Methods for Dual Network Address Translation
US20160212696A1 (en) * 2013-09-26 2016-07-21 Huawei Technologies Co., Ltd. Data Packet Processing Method, Network Traffic Management Method, Apparatus, and System
WO2017032058A1 (en) * 2015-08-21 2017-03-02 中兴通讯股份有限公司 Network switching method and apparatus, and computer readable storage medium
US20170272317A1 (en) * 2016-03-18 2017-09-21 Plume Design, Inc. Cloud-based control of a wi-fi network
CN107809377A (en) * 2016-09-09 2018-03-16 卡斯柯信号有限公司 The realization device and method of a kind of universal gateway
US20180091420A1 (en) * 2016-09-26 2018-03-29 Juniper Networks, Inc. Distributing service function chain data and service function instance data in a network
CN111600741A (en) * 2020-04-02 2020-08-28 怀来斯达铭数据有限公司 Method and system for setting network card IP address
CN111817962A (en) * 2020-07-01 2020-10-23 厦门立林科技有限公司 Android system multi-network-card intelligent routing method
US20200382419A1 (en) * 2019-05-31 2020-12-03 Microsoft Technology Licensing, Llc Distributed sonic fabric chassis

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140219280A1 (en) * 2013-01-02 2014-08-07 Acceleration Systems, LLC Systems and Methods for Dual Network Address Translation
US20160212696A1 (en) * 2013-09-26 2016-07-21 Huawei Technologies Co., Ltd. Data Packet Processing Method, Network Traffic Management Method, Apparatus, and System
CN103957572A (en) * 2014-05-20 2014-07-30 普天信息技术有限公司 Android-system-based distribution method through multi-network route policy
WO2017032058A1 (en) * 2015-08-21 2017-03-02 中兴通讯股份有限公司 Network switching method and apparatus, and computer readable storage medium
US20170272317A1 (en) * 2016-03-18 2017-09-21 Plume Design, Inc. Cloud-based control of a wi-fi network
CN107809377A (en) * 2016-09-09 2018-03-16 卡斯柯信号有限公司 The realization device and method of a kind of universal gateway
US20180091420A1 (en) * 2016-09-26 2018-03-29 Juniper Networks, Inc. Distributing service function chain data and service function instance data in a network
US20200382419A1 (en) * 2019-05-31 2020-12-03 Microsoft Technology Licensing, Llc Distributed sonic fabric chassis
CN111600741A (en) * 2020-04-02 2020-08-28 怀来斯达铭数据有限公司 Method and system for setting network card IP address
CN111817962A (en) * 2020-07-01 2020-10-23 厦门立林科技有限公司 Android system multi-network-card intelligent routing method

Also Published As

Publication number Publication date
CN113765802B (en) 2023-08-08

Similar Documents

Publication Publication Date Title
US7957365B2 (en) Connection routing based on link utilization
CN112671641B (en) Message forwarding method and device
US20080140847A1 (en) Method and System For Optimizing Dns Queries
WO2018020317A1 (en) Method and apparatus for controlling data forwarding in pon
CN109842564B (en) Method, network device and system for sending service message
CN108259378B (en) Message processing method and device
WO2015165249A1 (en) Method and device for establishing service path
CN108965121A (en) Transmit method, host and the interchanger of data
CN112583718A (en) SRv6 message transmission method, system, equipment and medium in SRoU scene
CN102315918B (en) Method and device for intercommunicating TCP (Transmission Control Protocol) connection with SCTP (Stream Control Transmission Protocol) connection
CN113765802B (en) android device network card dynamic switching method, system, terminal and storage medium
WO2000033513B1 (en) Telecommunication apparatus and method for forwarding packets using separate collision domains
CN104023091B (en) A kind of multilink fusion method and equipment
CN104471538A (en) Data stream processing method, device and system
US20220400408A1 (en) Application identification and path selection at a wireless access point for local network traffic breakout
CN116095038A (en) Gigabit network forwarding system and method based on domestic FPGA
US20100238930A1 (en) Router and method of forwarding ipv6 packets
CN115514828A (en) Data transmission method and electronic equipment
CN105553698A (en) Traffic counting method and traffic counting system based on local area network
CN114125983A (en) Routing method, session management entity, system and medium for mobile network user plane
US11606719B2 (en) Application identification and path selection at a wireless access point for local network traffic breakout
CN110120985A (en) The method and apparatus of communication
CN113783808A (en) Data forwarding method and device for adaptive switching of forwarding modes
CN102916881B (en) Message transmitting method and routing device
CN113452471A (en) Method, electronic device and computer program product for data processing

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant