CN106817303A - Share the method and system of network between personal computer and mobile device - Google Patents

Share the method and system of network between personal computer and mobile device Download PDF

Info

Publication number
CN106817303A
CN106817303A CN201611143654.5A CN201611143654A CN106817303A CN 106817303 A CN106817303 A CN 106817303A CN 201611143654 A CN201611143654 A CN 201611143654A CN 106817303 A CN106817303 A CN 106817303A
Authority
CN
China
Prior art keywords
mobile device
personal computer
network
usb port
usb
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.)
Pending
Application number
CN201611143654.5A
Other languages
Chinese (zh)
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.)
Beijing Yuanxin Science and Technology Co Ltd
Original Assignee
Beijing Yuanxin Science and 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 Beijing Yuanxin Science and Technology Co Ltd filed Critical Beijing Yuanxin Science and Technology Co Ltd
Priority to CN201611143654.5A priority Critical patent/CN106817303A/en
Publication of CN106817303A publication Critical patent/CN106817303A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/14Routing performance; Theoretical aspects
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

This application discloses the method and system for sharing network between personal computer and mobile device, wherein the personal computer is connected by USB connecting lines with the mobile device, methods described includes:It is virtually USB network card by the USB port of the USB port of the personal computer and the mobile device;It is virtually a router by the mobile device;Make the router that the data network of the mobile device are shared with into the personal computer by the USB network card.The present invention can make the data network that the individual calculus function without wireless networking capabilities shares mobile device be surfed the Net, and allowing user to be surfed the Net using personal computer becomes very convenient.

Description

Share the method and system of network between personal computer and mobile device
Technical field
The application is related to the transmission of information, more particularly to network sharing method and system.
Background technology
In current Intelligent mobile equipment, 4G and wifi has turned into common standard hardware configuration, connection network online As the thing that the big daily life of a family is done.But on personal computer (PC, personal computer), 4g and wifi do not turn into also Standard hardware is configured, and user can only be surfed the Net by cable network, very inconvenient.
The content of the invention
In order to overcome the deficiencies in the prior art, the technical problem to be solved in the present invention to be to provide a kind of in individual's meter Share the method and system of network between calculation machine and mobile device, it shares the individual calculus function without wireless networking capabilities The data network of mobile device is surfed the Net, and becomes very convenient so as to allow user to be surfed the Net using PC.
In order to solve the above technical problems, the method for sharing network between personal computer and mobile device of the invention, Wherein described personal computer is connected by USB connecting lines with the mobile device, and methods described includes:
It is virtually USB network card by the USB port of the USB port of the personal computer and the mobile device;
It is virtually a router by the mobile device, the router is by the USB network card by its data network It is shared with the personal computer.
It is described by the USB port of the personal computer and the mobile device as the improvement of the method for the invention USB port virtually for USB network card includes:By the source ip address conversions of the personal computer into the mobile device data The ip addresses of network.
Improved as the another kind of the method for the invention, described is virtually a router bag by the mobile device Include:Routing policy table is set;Routing rule is set, it is determined that the outlet of the USB port incoming data through the mobile device.
Used as another improvement of the method for the invention, methods described also includes:To the USB by the mobile device Port incoming data is marked.
Used as the further improvement of the method for the invention, the described pair of USB port by the mobile device enters Data mark including:Iptables is set, to being marked from the USB port incoming data of the mobile device.
In order to solve the above technical problems, the system for sharing network between personal computer and mobile device of the invention, Wherein described personal computer is connected by USB connecting lines with the mobile device, and the system includes:
Network interface card virtual module, for the USB port of the USB port of the personal computer and the mobile device is virtual It is USB network card;
Router virtual module, for being virtually a router by the mobile device, the router is by described Its data network is shared with the personal computer by USB network card.
In order to solve the above technical problems, tangible computer computer-readable recording medium of the invention, including for performing in individual calculus Share the computer program code of the method for network between machine and mobile device, the computer program code includes, for inciting somebody to action The USB port of the USB port of the personal computer and the mobile device is virtually the executable code of USB network card;For Be virtually the executable code of router by the mobile device, wherein the router by the USB network card by its Data network is shared with the personal computer.
In order to solve the above technical problems, the present invention provides a kind of device, including at least one processor;And at least one deposit Reservoir, containing computer program code, at least one memory and the computer program code are configured to, with institute At least one processor is stated so that described device execution is of the invention to share network between personal computer and mobile device At least part of step of method.
According to the present invention, PC can be by USB interface using the wifi/4g networks in mobile device, by sharing movement Wifi the and 4g networks online of equipment, user can be allowed to be surfed the Net using PC becomes very convenient.
After the detailed description of embodiment of the present invention is read in conjunction with the figure, other features of the invention and advantage will become more Plus it is clear.
Brief description of the drawings
Fig. 1 is the flow chart of the embodiment according to the inventive method.
Fig. 2 is according to PC of the invention and mobile device connection diagram.
Fig. 3 is the flow chart of another embodiment according to the inventive method.
Fig. 4 is the schematic diagram of the data network online that PC according to the present invention shares mobile device.
Fig. 5 is the structural representation of the embodiment according to present system.
For clarity, these accompanying drawings are figure that is schematic and simplifying, and they are only gived for understanding institute of the present invention Necessary details, and omit other details.
Specific embodiment
Embodiments of the present invention and embodiment are described in detail with reference to the accompanying drawings.
By detailed description given below, the scope of application of the invention will be evident that.It will be appreciated, however, that detailed While thin description and specific example show the preferred embodiment of the present invention, they are given only for illustration purpose.
Fig. 1 shows a reality of the method for sharing network between personal computer PC and mobile device of the invention Apply the flow chart of example.Wherein, as shown in Figure 2, PC passes through USB connecting lines by its USB port pusb0 and the USB port of mobile device Usb0 is connected, and it is the lte0 of the 4g networks and wlan0 of wifi network that mobile device has two network card equipments.
Each step for sharing the method for network between PC and mobile device is carried out specifically in conjunction with flow chart shown in Fig. 1 Explanation.
In step s 102, nat (network address translation, network address translation) is set, by PC's Source ip address conversions are into the ip addresses of the data network of mobile device.
In step S104, routing policy table is set.Policybased routing refers to the control that can be flexibly set according to user's request The mechanism of packet routing forwarding processed, i.e., flow to for control data.Routing policy table is the tables of data of conversation strategy route.
In step s 106, routing rule is set, it is determined that through the USB port usb0 incoming datas of the mobile device Outlet.
A kind of implementation method of the invention, before using the inventive method, need to enter to PC ends online routing mechanism Row is set, and it is same network segment ip ground that the ip addresses of the USB port pusb0 of PC are set to the USB port usb0 of mobile device Location;The default route of PC is changed, data traffic is set and is passed in and out through pusb0, its false code is, for example,:
ip route replace default via xxx.xxx.xxx.xxx dev$pusb0
Fig. 3 shows the another of the method for sharing network between personal computer PC and mobile device of the invention The flow chart of embodiment.The embodiment is similar with embodiment illustrated in fig. 1, but the USB port usb0 through mobile device is entered Data are also marked by setting iptables, and the data for possessing not isolabeling send from different outlets.Equally, such as Fig. 2 Shown in 4, with the USB port usb0 of mobile device be connected its USB port pusb0 by USB connecting lines by PC, mobile device tool There is the two network card equipments i.e. wlan0 of the lte0 of 4g networks and wifi network.
Have to each step for sharing the method for network between PC and mobile device with reference to flow chart shown in Fig. 3 Body explanation.
In step s 302, in mobile device system, iptables is set, to being stamped in turn by usb0 incoming datas The mark (mark based on connection) of mark1 (0x100), mark2 (0x200), as shown in Figure 4.Implementation of pseudocode is as follows,
iptables-t mangle-A PREROUTING-s$pusb0-ip-m conntrack--ctstate NEW-m statistic--mode nth--every$xx--packet 1-j CONNMARK--set-mark$mark1
iptables-t mangle-A PREROUTING-s$pusb0-ip-m conntrack--ctstate NEW-m statistic--mode nth--every$xx--packet 0-j CONNMARK--set-mark$mark2
In step s 304, nat is set, and false code is as follows,
iptables-t nat-A POSTROUTING-s$pusb0-mask-o wlan0-j MASQUERADE
iptables-t nat-A POSTROUTING-s$pusb0-ip-o seth_lte0-j MASQUERADE
In step S306, two policybased routing tables table1 (200) and table2 (201) are set, false code is as follows
ip route add default via wlan-getway table$table1
ip route add$pusb0-ip dev usb0 table$table1
ip route add default via lte-getway table$table2
ip route add$pusb0-ip dev usb0 table$table2
In step S308, Provisioning Policy routing rule, herein for be masked as mark1 walk outlet 1 (wlan), mark Mark2's walks outlet 2 (lte), as shown in Figure 4.False code is expressed as follows,
ip rule add pref$xxx fwmark$mark1 table$table1
ip rule add pref$xxx fwmark$mark2 table$table2
According to the embodiment, the data of PC are sent to mobile device by usb0 network interface cards, and mobile device passes through iptables Nth mechanism to doing mark marks from the source ip of usb0 incoming datas, marked to entering from usb0 by different mark Data do policybased routing, and the data for making to possess not isolabeling send from different outlets (wlan0 or lte0 is exported).So as to PC can To use the network of wifi/4g in mobile device by usb0 interfaces, and guarantee does not result in network system data conflict.
Fig. 5 shows an implementation of the system for sharing network between personal computer and mobile device of the invention The structural representation of example, wherein the personal computer is connected by USB connecting lines with the mobile device, the system bag Include:Mark module 510, for being marked to the USB port incoming data by the mobile device;Network interface card virtual module 520, for being virtually USB network card by the USB port of the USB port of the personal computer and the mobile device;Router Virtual module 530, for by the mobile device virtually be a router, the router by the USB network card by its Data network is shared with the personal computer.Wherein, the network interface card virtual module 520 includes network address translation submodule 522, for by the source ip address conversions of the personal computer into the ip addresses of the data network of the mobile device;And it is described Router virtual module 530 includes:Routing policy table setup module 532, for setting routing policy table;Routing rule sets mould Block 534, for setting routing rule, its determination through the USB port incoming data of the mobile device outlet.
Multiple difference embodiments described herein or its special characteristic, structure or characteristic can be at one of the invention or many It is appropriately combined in individual implementation method.In addition, in some cases, if suitably, in flow chart and/or stream treatment description step Rapid order can be changed, and accurately must not necessarily be performed in the described sequence.In addition, multiple different aspects of the invention can be used Software, hardware, firmware or its other computer-implemented modules or device for combining and/or performing the function carry out reality Apply.Software implementation of the invention may include to be stored in computer-readable medium and by holding that one or more processors are performed Line code.Computer-readable medium may include computer hard disc driver, ROM, RAM, flash memory, pocket computer storage medium such as CD-ROM, DVD-ROM, flash disc drives and/or such as other devices with USB (USB) interface, and/or appoint What its appropriate tangible or non-of short duration computer-readable medium or executable code can be preserved thereon and by computing device Computer storage.The present invention can be used with reference to any appropriate operating system.
Unless explicitly stated otherwise, singulative as used herein " ", " being somebody's turn to do " include plural reference (i.e. with " at least one " The meaning).It will be further understood that terminology used herein " having ", " including " and/or "comprising" show to exist it is described Feature, step, operation, element and/or part, but do not preclude the presence or addition of one or more other features, step, behaviour Work, element, part and/or its combination.Term "and/or" as used in this includes one or more relevant items enumerated Any and all combination.
Some currently preferred embodiments of the present invention is foregoing described, it should be emphasized, however, that the present invention is not limited to these Embodiment, and can be the other manner realization in the range of present subject matter.Those skilled in the art can be in the technology of the present invention The inspiration of design and do not depart from various changes and modifications are made to the present invention on the basis of present invention, these deformations or change Still fall within protection scope of the present invention.

Claims (10)

1. a kind of method for sharing network between personal computer and mobile device, wherein the personal computer passes through USB Connecting line is connected with the mobile device, it is characterised in that methods described includes:
It is virtually USB network card by the USB port of the USB port of the personal computer and the mobile device;
It is virtually a router by the mobile device, the router is shared its data network by the USB network card To the personal computer.
2. method according to claim 1, it is characterised in that described by the USB port of the personal computer and described The USB port of mobile device is virtually for USB network card includes:
By the source ip address conversions of the personal computer into the ip addresses of the data network of the mobile device.
3. method according to claim 1, it is characterised in that described is virtually a router bag by the mobile device Include:
Routing policy table is set;
Routing rule is set, it is determined that the outlet of the USB port incoming data through the mobile device.
4. method according to claim 1, it is characterised in that methods described also includes:
USB port incoming data by the mobile device is marked.
5. method according to claim 4, it is characterised in that the described pair of USB port by the mobile device enters Data mark including:
Iptables is set, to being marked from the USB port incoming data of the mobile device.
6. according to any described methods of claim 1-5, it is characterised in that methods described also includes:
It is the same network segment that the ip addresses of the USB port of the personal computer are set to the USB port of the mobile device Ip addresses;
The default route of the personal computer is changed, data traffic is set and is passed in and out through its USB port.
7. a kind of system for sharing network between personal computer and mobile device, wherein the personal computer passes through USB Connecting line is connected with the mobile device, it is characterised in that the system includes:
Network interface card virtual module, for being virtually by the USB port of the USB port of the personal computer and the mobile device USB network card;
Router virtual module, for being virtually a router by the mobile device, the router is by the USB nets Its data network is shared with the personal computer by card.
8. system according to claim 7, it is characterised in that the network interface card virtual module includes:
Network address translation submodule, for by the source ip address conversions of the personal computer into the mobile device data The ip addresses of network.
9. system according to claim 7, it is characterised in that the router virtual module includes:
Routing policy table setup module, for setting routing policy table;
Routing rule setup module, for setting routing rule, its determination through the mobile device USB port incoming data Outlet.
10. system according to claim 7, it is characterised in that the system also includes:
Mark module, for being marked to the USB port incoming data by the mobile device.
CN201611143654.5A 2016-12-13 2016-12-13 Share the method and system of network between personal computer and mobile device Pending CN106817303A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611143654.5A CN106817303A (en) 2016-12-13 2016-12-13 Share the method and system of network between personal computer and mobile device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611143654.5A CN106817303A (en) 2016-12-13 2016-12-13 Share the method and system of network between personal computer and mobile device

Publications (1)

Publication Number Publication Date
CN106817303A true CN106817303A (en) 2017-06-09

Family

ID=59108990

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611143654.5A Pending CN106817303A (en) 2016-12-13 2016-12-13 Share the method and system of network between personal computer and mobile device

Country Status (1)

Country Link
CN (1) CN106817303A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107770078A (en) * 2017-10-13 2018-03-06 广州视源电子科技股份有限公司 Interactive intelligent tablet computer, the transmission method of data, device and storage medium
CN114598600A (en) * 2022-02-15 2022-06-07 深圳市鸿合创新信息技术有限责任公司 Dual system for realizing network intercommunication

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101141354A (en) * 2007-10-11 2008-03-12 中兴通讯股份有限公司 Terminal of selecting access to mobile network or wireless LAN
CN201312390Y (en) * 2008-06-30 2009-09-16 Tcl集团股份有限公司 Mobile internet equipment
CN102130957A (en) * 2011-03-21 2011-07-20 中兴通讯股份有限公司 Mobile broadband equipment and use method thereof
CN102457990A (en) * 2010-10-28 2012-05-16 Tcl集团股份有限公司 Mobile terminal provided with WLAN (Wireless Local Area Network) card function and implementation method thereof
CN102523637A (en) * 2011-11-25 2012-06-27 华为终端有限公司 Ethernet base, network system and data forwarding method
CN102711181A (en) * 2012-06-05 2012-10-03 深圳市中兴移动通信有限公司 Method for mobile terminal to realize network shunt by utilizing multilink
CN102811164A (en) * 2011-05-31 2012-12-05 巴比禄股份有限公司 Portable network connection device,and method of setting portable network connection device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101141354A (en) * 2007-10-11 2008-03-12 中兴通讯股份有限公司 Terminal of selecting access to mobile network or wireless LAN
CN201312390Y (en) * 2008-06-30 2009-09-16 Tcl集团股份有限公司 Mobile internet equipment
CN102457990A (en) * 2010-10-28 2012-05-16 Tcl集团股份有限公司 Mobile terminal provided with WLAN (Wireless Local Area Network) card function and implementation method thereof
CN102130957A (en) * 2011-03-21 2011-07-20 中兴通讯股份有限公司 Mobile broadband equipment and use method thereof
CN102811164A (en) * 2011-05-31 2012-12-05 巴比禄股份有限公司 Portable network connection device,and method of setting portable network connection device
CN102523637A (en) * 2011-11-25 2012-06-27 华为终端有限公司 Ethernet base, network system and data forwarding method
CN102711181A (en) * 2012-06-05 2012-10-03 深圳市中兴移动通信有限公司 Method for mobile terminal to realize network shunt by utilizing multilink

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107770078A (en) * 2017-10-13 2018-03-06 广州视源电子科技股份有限公司 Interactive intelligent tablet computer, the transmission method of data, device and storage medium
WO2019071809A1 (en) * 2017-10-13 2019-04-18 广州视源电子科技股份有限公司 Interactive intelligent tablet, data transmission method, device and storage medium
CN114598600A (en) * 2022-02-15 2022-06-07 深圳市鸿合创新信息技术有限责任公司 Dual system for realizing network intercommunication

Similar Documents

Publication Publication Date Title
US10374952B2 (en) Method for increasing layer-3 longest prefix match scale
SG11201800020UA (en) Packet processing method in cloud computing system, host, and system
CN105634942B (en) Method and switch for forwarding message
CN105515992B (en) Flow entry processing method and processing device in VXLAN network
CN107147588B (en) Flow guiding method and device
CN105262685A (en) Message processing method and message processing device
CN104468368B (en) Configure the method and device of bgp neighbor
US20180324095A9 (en) Packet Processing Method and Device
CN106034046A (en) Method and device for sending access control list (ACL)
WO2017181807A1 (en) Sdn-based switch port information detection method, device, and terminal apparatus
CN104378410A (en) Minitype private cloud storage and transmission system and method
CN102711181B (en) A kind of mobile terminal utilizes multilink to realize the method for network shunt
JP2015076101A (en) Connector interface pin mapping
CN106383736A (en) Port extension method and apparatus
CN106817303A (en) Share the method and system of network between personal computer and mobile device
CN108259378A (en) A kind of message processing method and device
CN103442015A (en) Method and system for processing capwap tunnel data on wireless network controller based on linux virtual network card
CN105915604B (en) Cloud server network system architecture
CN106487894A (en) A kind of data sharing platform
US11611632B2 (en) Cloud to on-premise port forwarding with IP address bound to loopback alias
JP5995279B2 (en) Network device, method, and program
CN105245365A (en) Parameter configuration method, equipment and system for virtual network
CN108337243A (en) Message forwarding method, device and forwarding unit
US10554548B2 (en) Partially deferred packet access
JP2007531364A5 (en)

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20170609