CN113765802B - 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
CN113765802B
CN113765802B CN202110843209.4A CN202110843209A CN113765802B CN 113765802 B CN113765802 B CN 113765802B CN 202110843209 A CN202110843209 A CN 202110843209A CN 113765802 B CN113765802 B CN 113765802B
Authority
CN
China
Prior art keywords
network card
forwarding
function
route
network
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.)
Active
Application number
CN202110843209.4A
Other languages
Chinese (zh)
Other versions
CN113765802A (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

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 dynamic switching method of an android device network card, which comprises the following steps: the function of selecting the network card is a route forwarding function or a data packet receiving function; according to the result of the first step, switching and adjusting the state of the network card; by applying the method, the dynamic switching of the network card can be realized, the data receiving and transmitting functions and the data forwarding functions of the network card can be further fully exerted, the network card is fully utilized, the functional diversity of products 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, etc., and networks are used in these fields. The main network module of the android device is an ethernet network card, and can be connected to an external network through the network card. However, the network card has a data forwarding function (i.e., routing forwarding) in addition to transmitting/receiving data, but generally, the android device only uses one of the functions, i.e., data transmission and reception, and cannot fully perform all the functions of the network card.
Disclosure of Invention
The invention aims to solve the technical problems, and provides a dynamic switching method for an android device network card, a dynamic switching system for an android device network card, a dynamic switching terminal for an android device network card and a computer readable storage medium.
The technical scheme adopted for solving the technical problems is as follows:
a dynamic switching method for constructing an android device network card is provided, which comprises the following steps:
the first step: the function of selecting the network card is a route forwarding function or a data packet receiving function;
and a second step of: and carrying out conversion adjustment of the network card state according to the selection result in the first step.
The invention discloses a dynamic switching method of an android device network card, wherein when a route forwarding function is selected, the network card state adjusting method comprises the following steps:
setting the network card ip address, creating a routing table use rule, creating a forwarding rule, enabling a network card forwarding function and forwarding network data packets.
The invention discloses a dynamic switching method of an android device network card, wherein when a data packet receiving function is selected, the network card state adjusting method comprises the following steps:
deleting the routing forwarding rule, deleting the routing table of the routing forwarding, deleting the routing table using rule of the routing forwarding, closing the network card forwarding function, restarting the network card, and receiving and transmitting network data packets.
According to the android device network card dynamic switching method, the network card function is selected through the UI in the first step.
The android device network card dynamic switching system is used for realizing the android device network card dynamic switching method, and comprises a network card function selection unit and a network card state adjustment unit;
the network card function selecting unit is used for selecting the network card function as a routing forwarding function or a data packet receiving function;
the network card state adjusting unit is used for performing conversion adjustment on the network card state according to the selection result of the network card function selecting unit.
The network card dynamic switching system of the android device, provided by the invention, wherein when a route forwarding function is selected, the network card state adjusting unit performs the following operations on the network card: setting the network card ip address, creating a routing table use rule, creating a forwarding rule, enabling a network card forwarding function and forwarding network data packets.
The network card dynamic switching system of the android device, provided by the invention, 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 routing forwarding rule, deleting the routing table of the routing forwarding, deleting the routing table using rule of the routing forwarding, closing the network card forwarding function, restarting the network card, and receiving and transmitting network data packets.
The network card dynamic switching system of the android device, disclosed by the invention, wherein the selection of the network card function selection unit is realized through a UI (user interface).
The android equipment network card dynamic switching terminal 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 storing a computer program, wherein the computer program when executed by a processor implements the steps of the method as described above.
The invention has the beneficial effects that: by applying the method, the dynamic switching of the network card can be realized, the data receiving and transmitting functions and the data forwarding functions of the network card can be further fully exerted, the network card is fully utilized, the functional diversity of products 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, in which the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained by those skilled in the art without inventive effort:
FIG. 1 is a flow chart 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 the routing forwarding function of the dynamic switching method of the android device network card according to the preferred embodiment of the present invention;
FIG. 3 is a flowchart of a method for adjusting the data packet receiving function of the dynamic switching method of the android device network card according to the preferred embodiment of the present invention;
FIG. 4 is a schematic block diagram of a dynamic switching system for 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 more apparent, the following description will be made in detail with reference to the technical solutions in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by a person skilled in the art without any inventive effort, are intended to be within the scope of the present invention, based on the embodiments of the present invention.
The method for dynamically switching the android device network card according to the preferred embodiment of the invention is shown in fig. 1, and referring to fig. 2 and 3, the method comprises the following steps:
s01: the function of selecting the network card is a route forwarding function or a data packet receiving function;
s02: according to the result of the first step, switching and adjusting the state of the network card;
by applying the method, the dynamic switching of the network card can be realized, the data receiving and transmitting functions and the data forwarding functions of the network card can be further fully exerted, the network card is fully utilized, the functional diversity of products is improved, and the product value is improved.
Preferably, when selecting the routing forwarding function, the network card state adjusting method is as follows:
s021: setting a network card ip address;
the network card ip address can be set through the ifconfig instruction, and the network card is used as a route, and the ip address is a gateway address at the moment; and (3) carrying out the steps of (1): ifconfig eth 0.192.168.1.1;
s022: creating a routing table;
creating a routing table through an ip route add instruction, and adding a route for forwarding a 4g network and an Ethernet network route;
and (3) carrying out the steps of (1): creating a routing table 88 and adding a route to forward to a 4g network example ip route add ethernet network address dev eth0 proto static scope link table 88; ip route add default via 4g module gateway address devppp 0 proto static table 88;
s023: creating a routing table usage rule;
creating a routing table use rule 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;
forwarding rules can be created through iptables instructions;
eg:
an iptables-t nat-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 selecting a packet receiving function, the method for adjusting the network card status is as follows:
s031: deleting the route forwarding rule;
the following may be passed through iptables instructions, eg:
iptables-t nat–F;
s032: deleting a routing table for forwarding the route;
the data may be processed by the ip route del instruction, eg:
ip route del ethernet network address dev eth0 proto static scope link table 88;
ip route del default via 4g module gateway address devppp 0 proto static table 88;
s033: deleting the routing table usage rule of the routing forwarding;
the information may be encoded by the 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: closing the network card forwarding function;
the method can be implemented by instructions:
echo 0>/proc/sys/net/ipv4/ip_forward;
s035: restarting the network card;
the method can be implemented by instructions:
EthernetManager.setEthernetEnabled(false);
EthernetManager.setEthernetEnabled(true);
s036: and receiving and transmitting network data packets.
Of course, it can be understood that other existing instruction usage modes capable of realizing the required functions are also possible, and simple transformation based on the principle belongs to the protection scope of the application;
preferably, the selection of the network card function in the first step is implemented through a UI interface.
The network card dynamic switching system of the android device is used for realizing the network card dynamic switching method of the android device, as shown in fig. 4, and comprises a network card function selecting unit 1 and a network card state adjusting unit 2;
the network card function selecting unit 1 is used for selecting the function of the network card as a routing forwarding function or a data packet receiving function;
the network card state adjusting unit 2 is used for performing conversion adjustment of the network card state according to the selection result of the network card function selecting unit;
by applying the method, the dynamic switching of the network card can be realized, the data receiving and transmitting functions and the data forwarding functions of the network card can be further fully exerted, the network card is fully utilized, the functional diversity of products is improved, and the product value is improved.
Preferably, when the routing forwarding function is selected, the network card state adjustment unit 2 performs the following operations on the network card: setting the network card ip address, creating a routing table use rule, creating a forwarding rule, enabling a network card forwarding function and forwarding network data packets.
Preferably, when the packet receiving function is selected, the network card status adjusting unit 2 performs the following operations on the network card: deleting the routing forwarding rule, deleting the routing table of the routing forwarding, deleting the routing table using rule of the routing forwarding, closing the network card forwarding function, restarting the network card, and receiving and transmitting network data packets.
Preferably, the selection of the network card function selection unit 1 is implemented through a UI interface.
The android device network card dynamic switching terminal 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 storing a computer program, wherein the computer program when executed by a processor implements the steps of the method as described above.
It will be understood that modifications and variations will be apparent to those skilled in the art from the foregoing description, and it is intended that all such modifications and variations be included within the scope of the following claims.

Claims (6)

1. The dynamic switching method of the android device network card is characterized by comprising the following steps of:
the first step: the function of selecting the network card is a route forwarding function or a data packet receiving function;
and a second step of: according to the result of the first step, switching and adjusting the state of the network card;
when the route forwarding function is selected, the network card state adjusting method is as follows:
setting a network card ip address;
setting a network card ip address through an ifconfig instruction, and using the network card as a route, wherein the ip address is a gateway address;
creating a routing table;
creating a routing table through an ip route add instruction, and adding a route for forwarding a 4g network and an Ethernet network route;
creating a routing table usage rule;
creating a routing table use rule through an ip rule add instruction;
creating a forwarding rule;
creating a forwarding rule through an iptables instruction;
enabling a network card forwarding function;
forwarding a network data packet;
when selecting the data packet receiving function, the network card state adjusting method is as follows:
deleting the route forwarding rule;
through iptables instructions;
deleting a routing table for forwarding the route;
through an ip route del instruction;
deleting the routing table usage rule of the routing forwarding;
through an ip ruledel instruction;
closing the network card forwarding function;
restarting the network card;
and receiving and transmitting network data packets.
2. The method for dynamically switching network cards of android device according to claim 1, wherein the selection of the network card function in the first step is realized through a UI interface.
3. The android device network card dynamic switching system is used for realizing the android device network card dynamic switching method according to any one of claims 1-2, and is characterized by comprising a network card function selection unit and a network card state adjustment unit;
the network card function selecting unit is used for selecting the network card function as a routing forwarding function or a data packet receiving function;
the network card state adjusting unit is used for performing conversion adjustment of the network card state according to the selection result of the network card function selecting unit;
when the route forwarding function is selected, the network card state adjusting method is as follows:
setting a network card ip address;
setting a network card ip address through an ifconfig instruction, and using the network card as a route, wherein the ip address is a gateway address;
creating a routing table;
creating a routing table through an ip route add instruction, and adding a route for forwarding a 4g network and an Ethernet network route;
creating a routing table usage rule;
creating a routing table use rule through an ip rule add instruction;
creating a forwarding rule;
creating a forwarding rule through an iptables instruction;
enabling a network card forwarding function;
forwarding a network data packet;
when selecting the data packet receiving function, the network card state adjusting method is as follows:
deleting the route forwarding rule;
through iptables instructions;
deleting a routing table for forwarding the route;
through an ip route del instruction;
deleting the routing table usage rule of the routing forwarding;
through an ip ruledel instruction;
closing the network card forwarding function;
restarting the network card;
and receiving and transmitting network data packets.
4. The android device network card dynamic switching system of claim 3, wherein selection of the network card function of said network card function selecting unit is implemented through a UI interface.
5. A dynamic switching terminal for a network card of an android device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any one of claims 1 to 2 when executing the computer program.
6. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method according to any one of claims 1 to 2.
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 CN113765802A (en) 2021-12-07
CN113765802B true 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 (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017032058A1 (en) * 2015-08-21 2017-03-02 中兴通讯股份有限公司 Network switching method and apparatus, and computer readable storage medium
CN111600741A (en) * 2020-04-02 2020-08-28 怀来斯达铭数据有限公司 Method and system for setting network card IP address

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105122231A (en) * 2013-01-02 2015-12-02 加速***有限责任公司 Systems and methods for providing a ReNAT communications environment
CN103532878B (en) * 2013-09-26 2017-01-04 华为技术有限公司 The processing method of packet and the management method of network traffics and device and system
CN103957572A (en) * 2014-05-20 2014-07-30 普天信息技术有限公司 Android-system-based distribution method through multi-network route policy
US10708126B2 (en) * 2016-03-18 2020-07-07 Plume Design, Inc. Cloud-based control of a Wi-Fi network
CN107809377B (en) * 2016-09-09 2021-06-08 卡斯柯信号有限公司 Device and method for realizing universal gateway
US11277338B2 (en) * 2016-09-26 2022-03-15 Juniper Networks, Inc. Distributing service function chain data and service function instance data in a network
US11018973B2 (en) * 2019-05-31 2021-05-25 Microsoft Technology Licensing, Llc Distributed sonic fabric chassis
CN111817962B (en) * 2020-07-01 2022-06-14 厦门立林科技有限公司 Android system multi-network-card intelligent routing method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017032058A1 (en) * 2015-08-21 2017-03-02 中兴通讯股份有限公司 Network switching method and apparatus, and computer readable storage medium
CN111600741A (en) * 2020-04-02 2020-08-28 怀来斯达铭数据有限公司 Method and system for setting network card IP address

Also Published As

Publication number Publication date
CN113765802A (en) 2021-12-07

Similar Documents

Publication Publication Date Title
CN110266592B (en) Communication method and device for SRV6 network and IP MPLS network
CN112671641B (en) Message forwarding method and device
US20090034532A1 (en) Connection routing based on link utilization
CN109417533B (en) Method for transmitting data and forwarding device
CN112073283B (en) Method for generating forwarding table and forwarding equipment
WO2015165249A1 (en) Method and device for establishing service path
Tulumello et al. Micro SIDs: A solution for efficient representation of segment IDs in SRv6 networks
CN113765802B (en) android device network card dynamic switching method, system, terminal and storage medium
KR101304971B1 (en) Forwarding a packet in a sensor personal area network
CN104471538A (en) Data stream processing method, device and system
CN104023091B (en) A kind of multilink fusion method and equipment
US20100238930A1 (en) Router and method of forwarding ipv6 packets
CN110636003A (en) Message forwarding method, device, system and computer readable storage medium
CN113783808A (en) Data forwarding method and device for adaptive switching of forwarding modes
CN114125983A (en) Routing method, session management entity, system and medium for mobile network user plane
CN109962989A (en) The methods, devices and systems of based traversal network address gateway
CA3158506A1 (en) Satellite network acceleration and optimization
CN109218388B (en) Network data processing method, device and computer readable storage medium
WO2022222693A1 (en) Message processing method and apparatus, electronic device, and computer-readable storage medium
CN110601948B (en) Network bandwidth superposition method and device and gateway equipment
CN104871497A (en) Flow table processing method and apparatus
CN111835736B (en) Message transmission method and system
CN109150725A (en) Traffic grooming method and server
CN113726633B (en) Forwarding method and forwarding device
CN114039814B (en) Message forwarding method and device, electronic equipment and storage medium

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