CN113886323A - Network sharing method and device, electronic equipment and storage medium - Google Patents
Network sharing method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113886323A CN113886323A CN202110990808.9A CN202110990808A CN113886323A CN 113886323 A CN113886323 A CN 113886323A CN 202110990808 A CN202110990808 A CN 202110990808A CN 113886323 A CN113886323 A CN 113886323A
- Authority
- CN
- China
- Prior art keywords
- network
- network card
- network data
- source address
- data
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 57
- 238000004891 communication Methods 0.000 claims abstract description 31
- 230000003993 interaction Effects 0.000 claims abstract description 26
- 238000006243 chemical reaction Methods 0.000 claims description 20
- 230000003213 activating effect Effects 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 4
- 230000004044 response Effects 0.000 claims description 4
- 230000006870 function Effects 0.000 abstract description 7
- 238000010586 diagram Methods 0.000 description 7
- 238000005516 engineering process Methods 0.000 description 6
- 230000008859 change Effects 0.000 description 5
- 230000008569 process Effects 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000013519 translation Methods 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 230000009977 dual effect Effects 0.000 description 2
- 238000012423 maintenance Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 101150012579 ADSL gene Proteins 0.000 description 1
- 102100020775 Adenylosuccinate lyase Human genes 0.000 description 1
- 108700040193 Adenylosuccinate lyases Proteins 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000036632 reaction speed Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F15/00—Digital computers in general; Data processing equipment in general
- G06F15/16—Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
- G06F15/163—Interprocessor communication
- G06F15/173—Interprocessor communication using an interconnection network, e.g. matrix, shuffle, pyramid, star, snowflake
- G06F15/17306—Intercommunication techniques
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Theoretical Computer Science (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The application provides a network sharing method, a device, an electronic device and a storage medium, which are applied to an intelligent device, wherein communication connection between two systems is established, when output network data of a second network card is acquired, a source address of the output network data is converted, and an address of a second system recorded in the output network data is converted into an address of a first system, so that the output network data can be transmitted out through the first system when the second system needs to perform network data interaction, and therefore on the premise that network interaction functions of multiple systems are not influenced, hardware such as switches in the prior art can be saved, and the use of the two systems by a user is not influenced while cost is saved.
Description
Technical Field
The present application relates to the field of communications technologies, and in particular, to a network sharing method and apparatus, an electronic device, and a storage medium.
Background
With the development of science and technology and the higher and higher application experience requirements of users, meanwhile, as each operating system has the characteristics or the advantages of the operating system, in order to meet different requirements, the intelligent equipment with double systems or multiple systems slowly enters the sight of people.
For an intelligent device provided with two or more sets of operating system hardware devices, in order to achieve the purposes of network sharing and the like, a common method is to add a switch or a network bridge between two systems to achieve network sharing. However, adding one more hardware device to the smart device will inevitably increase the production cost of the whole device.
Disclosure of Invention
In view of the above, an object of the present application is to provide a network sharing method, apparatus, electronic device and storage medium.
Based on the above purpose, the present application provides a network sharing method, which is applied to an intelligent device, where the intelligent device is provided with a first system and a second system that are in communication connection, the first system includes a first network card, and the second system includes a second network card;
the method comprises the following steps:
acquiring output network data transmitted from the second network card to the first network card;
converting the source address of the output network data into a source address corresponding to the first network card to obtain converted output network data;
and sending the converted output network data to the first network card so that the first network card sends the converted output network data to an external network.
In some embodiments, after sending the converted output network data to the first network card, the method further comprises:
acquiring input network data transmitted from the external network to the first network card; the input network data is network data generated by the external network in response to the converted output network data;
converting the destination address of the input network data into a source address corresponding to the second network card to obtain converted input network data;
and transmitting the converted input network data to the second network card.
In some embodiments, the number of the second systems is multiple, and each second system includes a corresponding second network card; the output network data carries identification information of the second network card;
the converting the destination address of the input network data into the source address corresponding to the second network card to obtain the converted input network data includes:
determining a source address corresponding to the target second network card according to the identification information; the target second network card is a second network card for transmitting the output network data;
converting the destination address of the input network data into a source address corresponding to the target second network card to obtain converted input network data;
the transmitting the converted input network data to the second network card includes:
and transmitting the converted input network data to the target second network card.
In some embodiments, the determining, according to the identification information, a source address corresponding to the target second network card includes:
searching a source address corresponding to the identification information in a second network card address corresponding table according to the identification information to determine the source address corresponding to the target second network card; and the second network card address corresponding table stores the corresponding relationship between the identification information and the source address corresponding to the second network card.
In some embodiments, the output network data carries an output time of the output network data;
the converting the source address of the output network data into the source address corresponding to the first network card to obtain the converted output network data includes:
determining a source address corresponding to the first network card according to the output time; the source addresses corresponding to the first network card are the same at the same time, and the source addresses corresponding to the first network card are different at different times;
and converting the source address of the output network data into the source address corresponding to the first network card to obtain the converted output network data.
In some embodiments, the converting the source address of the output network data into the source address corresponding to the first network card to obtain the converted output network data includes:
acquiring a source address list corresponding to the first network card; a plurality of source addresses corresponding to the first network card are stored in the source address list;
and converting the source address of the output network data into any one source address in the source address list to obtain the converted output network data.
In some embodiments, before the acquiring the output network data transmitted from the second network card to the first network card, the method further includes:
activating the first network card to enable the first system to perform network interaction through the first network card;
and activating the second network card, acquiring routing information of the second network card, and writing the routing information into the first network card so as to establish a data communication channel between the first network card and the second network card.
Based on the same concept, the application also provides a network sharing device which is applied to intelligent equipment, wherein the intelligent equipment is provided with a first system and a second system which are in communication connection, the first system comprises a first network card, and the second system comprises a second network card;
the apparatus, comprising:
the acquisition module is used for acquiring output network data transmitted from the second network card to the first network card;
the conversion module is used for converting the source address of the output network data into the source address corresponding to the first network card to obtain the converted output network data;
and the output module is used for sending the converted output network data to the first network card so that the first network card sends the converted output network data to an external network.
Based on the same concept, the present application also provides an electronic device, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to implement the method according to any one of the above.
Based on the same concept, the present application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to implement the method of any one of the above.
As can be seen from the foregoing, the network sharing method, apparatus, electronic device, and storage medium provided in the present application are applied to an intelligent device, and establish a communication connection between two systems, and when acquiring output network data of a second network card, convert a source address of the output network data, and convert an address of the second system recorded in the output network data into an address of a first system, so that the output network data can be transmitted through the first system when the second system needs to perform network data interaction, so that hardware such as a switch in the prior art can be saved on the premise of not affecting a network interaction function of multiple systems, and the use of the dual systems by a user is not affected while the cost is saved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments or related technologies, the drawings needed to be used in the description of the embodiments or related technologies are briefly introduced below, it is obvious that the drawings in the following description are only the embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a network sharing method according to an embodiment of the present application;
fig. 2 is a schematic diagram illustrating a specific application flow of a network sharing method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a network sharing device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present specification more apparent, the present specification is further described in detail below with reference to the accompanying drawings in combination with specific embodiments.
It should be noted that technical terms or scientific terms used in the embodiments of the present application should have a general meaning as understood by those having ordinary skill in the art to which the present application belongs, unless otherwise defined. The use of "first," "second," and similar terms in the embodiments of the present application do not denote any order, quantity, or importance, but rather the terms are used to distinguish one element from another. The word "comprising" or "comprises", and the like, means that a element, article, or method step that precedes the word, and includes the element, article, or method step that follows the word, and equivalents thereof, does not exclude other elements, articles, or method steps. The terms "connected" or "coupled" and the like are not restricted to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "upper", "lower", "left", "right", and the like are used merely to indicate relative positional relationships, and when the absolute position of the object being described is changed, the relative positional relationships may also be changed accordingly.
As described in the background section, for an intelligent device provided with two or more sets of operating system hardware devices, such as a computer equipped with two or more hosts, currently, to implement interaction or network sharing between these hosts, switch hardware, such as switch hardware, needs to be added between the hosts, where two or more systems are respectively connected to different ports of the switch, and an external port is also connected to one port of the switch, so that network sharing can be implemented.
However, such an arrangement would increase the overall product cost after the addition of the hardware switch. Moreover, when one system of the multiple systems is accessed to the wireless network, because the hardware switch itself cannot perform wireless network connection, other systems cannot realize network sharing of the multiple systems through the hardware switch, and other systems can only perform wired or wireless connection through respective network cards and cannot realize network sharing.
In combination with the above actual situation, the embodiment of the present application provides a network sharing method, which is applied to an intelligent device with multiple systems. The intelligent device can be a computer provided with at least two system hosts, an intelligent large screen provided with at least two sets of system hardware, a portable computer or a mobile terminal and the like. In the smart device, a plurality of systems are directly connected in communication by means of data lines and the like, for example, connected by USB lines, network lines, COM lines or Type-C lines and the like. Each system comprises a network card, and the systems communicate through the network cards arranged in the systems. When one of the network cards is connected with an external network, the other network cards can also perform data interaction with the external network through communication between the other network cards and the network card. According to the embodiment of the application, hardware such as switches and the like arranged among systems in the prior art can be saved on the premise of not influencing the network interaction function of multiple systems, and the use of users on multiple systems is not influenced while the cost is saved. The following describes specific examples of the present application.
As shown in fig. 1, a schematic flow chart of a network sharing method provided in an embodiment of the present application is shown, where the method specifically includes:
In this step, by acquiring the output network data of the second network card, address conversion is performed on the output network data of the second network card at the first network card side in the subsequent steps, so that the second network card can perform network data interaction through the first network card.
In this step, the first network card is a network card set in a first system of the intelligent device, and the second network card is a network card set in a second system of the intelligent device. The first system and the second system can be any intelligent operating system, such as an android system, a windows system, a Linux system and the like. The first system and the second system may be the same or different in type, and the embodiments of the present application are not limited thereto. After the first system is connected with an external network, a first network card in the first system is started, and the first system performs data interaction with the external network through the first network card. The first network card type is also different according to the external network type. When the external network is a wired network, the first network card is a wired network card; when the external network is a wireless network, the first network card is a wireless network card. The second network card can be a wired network card or a wireless network card. In order to save cost and to establish a stable connection with the first network card, the second network card is generally a wired network card.
The output network data is network data transmitted by the second system to the external network. And a communication channel is established between the second network card and the first network card, when the output network data is transmitted, the processor of the second system generates output network data according to the operation of the user on the intelligent device, the output network data is transmitted to the second network card, and the second network card transmits the output network data to the first network card through the communication channel. And then, the output network data is output data of the second system in the network interaction process, and is generally request uplink data.
And 102, converting the source address of the output network data into a source address corresponding to the first network card to obtain the converted output network data.
In this step, the address conversion of the output network data is completed by converting the source address of the output network data, and the output network data transmitted by the second network card is converted into the output network data to be transmitted by the first network card.
In a data interaction scenario, the source address of the output network data is the IP address of the system that outputs the data packet of the output network data, and is generally recorded in the header portion of the data packet. In this step, the source address of the output network data is the IP address of the second system. The same source address corresponding to the first network card is the IP address of the first system corresponding to the first network card. That is, in this step, the header portion in the data packet of the output network data is modified, and the recorded output address is modified from the IP address of the second system to the IP address of the first system.
In a specific application scenario, dynamic source address target conversion (SNAT) may be performed on data output by the second network card on the first network card side. For example, in a network formed by a first system and a second system, the first system can communicate with an external network through a first network card, that is, the first network card is connected to a public network, a second network card of the second system is only connected to the first network card, that is, the second network card is connected to an intranet, and the second network card can communicate with the external network only through the first network card. When the second system needs to access the external network, the header part of the output data packet can only fill in the IP address of the internal network, and the output data packet can only flow in the internal network. And then, the second system transmits the data packet to the first network card through the intranet through the second network card, the header part of the data packet is replaced at the first network card, and the data packet is replaced by the IP address of the first system corresponding to the first network card. And finally, generating the converted output network data after the source address conversion is finished.
In this step, the converted output network data is seen by the external network as data output by the first network card, and at the external network end, the converted output network data is only considered to be in data interaction with the first network card, so that the network data interaction can be performed even if the second network card of the second system is not communicated with the external network. That is, at this time, the external network acquires the data packet that has been the output network data of the replaced header portion, and records the public network IP address of the first system, but not the internal network IP address of the second system.
In a specific application scenario, as shown in fig. 2, a schematic diagram of a specific application flow of the network sharing method provided by the present application is shown. In the dual-system device, the wired or wireless connection of the Android system serving as the first system is successful, and the corresponding wired network card A or wireless network card B is started, so that the Android system can surf the internet. Starting the network card C of the second system, updating the route of the network card C to the wired network card A or the wireless network card B, so as to establish a communication channel between the two network cards, and further establish communication connection between the first system and the second system, and the network data output outwards by the second system carries out source address conversion at the wired network card A or the wireless network card B, so that the external network considers that the network data is transmitted by the first system but not transmitted by the second system when receiving the network data.
As can be seen from the above, in the embodiment of the present application, by establishing a communication connection between two systems, and when acquiring the output network data of the second network card, converting the source address of the output network data, and converting the address of the second system recorded in the output network data into the address of the first system, the output network data can be transmitted through the first system when the second system needs to perform network data interaction, so that on the premise of not affecting the network interaction function of multiple systems, hardware such as switches in the prior art can be saved, and the use of the dual systems by a user is not affected while the cost is saved.
It should be noted that the method of the embodiment of the present application may be executed by a single device, such as a computer or a server. The method of the embodiment of the application can also be applied to a distributed scene and is completed by the mutual cooperation of a plurality of devices. In such a distributed scenario, one of the multiple devices may only perform one or more steps of the method of the embodiment, and the multiple devices interact with each other to complete the method.
It should be noted that the above-mentioned description describes specific embodiments of the present application. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments described above and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
In other embodiments, after the converted output network data is sent to the first network card, the input network data transmitted from the external network to the first network card is acquired; the input network data is network data generated by the external network in response to the converted output network data; converting the destination address of the input network data into a source address corresponding to the second network card to obtain converted input network data; and transmitting the converted input network data to a second network card.
In this embodiment, the input network data corresponds to the output network data, and is feedback data generated for the output network data by the external network. In this step, after the first network card outputs an output network data, the external network generally generates an input network data according to the output network data and transmits the input network data back, and the input network data necessarily carries the identifier of the output network data corresponding to the input network data. Therefore, the identifier can be used to determine the feedback information of which output network data the input network data is, and then the output network data can be used to determine which network card is the final data transmitted. Then, destination address translation (DNAT) is performed on the input network data belonging to the second network card. In a specific application scenario, the first system and the second system form an intranet, wherein a second network card of the second system is configured with an intranet IP address, and a first network card of the first system is configured with a public network IP address. When a data packet of the output network data of the second network card is acquired, the first system performs source address conversion on the data packet and records the identifier of the data packet. And then, after receiving the data packet, the external network generates a data packet of input network data according to the data packet and transmits the data packet to the first network card, and at the moment, the target address of the data packet writes the public network IP address of the first network card. At this time, the data packet inevitably carries information related to the output network data corresponding to the data packet, and the actual destination address of the input network data, which is the source address corresponding to the second network card in this embodiment, can be finally confirmed by comparing the information with the previous identifier. Then, the destination address of the packet head part of the data packet of the input network data is rewritten into the intranet IP address of the second network card, and then the data packet is sent to the second network card of the intranet, so that the data packet passes through the first network card and is changed from the public network IP into access to the intranet address. And finally, after the data input by the external network passes through the DNAT, the data of the external network is forwarded to the side of the second network card from the side of the first network card through a data forwarding program, so that network sharing is finally completed. In a specific application scenario, the data of the second network card may be forwarded through the kernel. Kernel refers to the core of most operating systems. It consists of those parts of the operating system that are used to manage memory, files, peripherals, and system resources. The operating system kernel typically runs processes and provides inter-process communication.
In some other embodiments, the number of the second systems is multiple, and each second system comprises a corresponding second network card; the output network data carries the identification information of the second network card; converting the destination address of the input network data into a source address corresponding to the second network card to obtain the converted input network data, including: determining a source address corresponding to the target second network card according to the identification information; the target second network card is a second network card for transmitting and outputting network data; converting the destination address of the input network data into a source address corresponding to the target second network card to obtain converted input network data; transmitting the converted input network data to a second network card, comprising: and transmitting the converted input network data to the target second network card. Therefore, the system input data specifically corresponding to the input network data is accurately identified, and the data transmission is accurately carried out.
In this embodiment, the identification information is information that can point to the corresponding second network card, and the first system can accurately find the second network card through this information, and can distinguish which information belongs to the second network card or the second system. In a specific application scenario, a label of each network card can be set, when the network card generates output network data, the output network data carries the label, and when source address conversion is performed on the first network card side, label recording is performed; when the external network acquires the output network data, although the source address of the output network data changes, the label cannot be changed, and when the external network generates the input network data, the label is transferred to the input network data; when the first network card receives the input network data, it can identify the input network data as the feedback of which output network data, specifically as the data of which network card, according to the tag. In a specific application scenario, the first system may be an android system, and the plurality of second systems may be windows systems, mac systems, or linux systems. Then, after the identification information is sent to the first network card side, the content of the identification information is written into the data interaction service of the first system, different operating systems generally correspond to different data interaction service programs, and the data interaction service of the Android system, for example, is netD. In a specific application scenario, after the routing information of the second network card is updated to the first network card, the netD of the Android system of the first system is stopped, the second network card is added into the netD (i.e., the identification information of the second network card is added into the netD of the first system), and the netD is restarted. Therefore, the acquired input network data of the external network can be accurately identified to which second system the input network data is finally transmitted at the first network card side. Then, since the input network data is generally feedback for the output network data, the input network data necessarily carries the relevant information of the output network data corresponding to the input network data, and the first system can determine the identification information corresponding to the input network data by reading the relevant information, so that the corresponding second network card, namely the target second network card, can be accurately determined according to the identification information. And finally, after the target second network card is determined, the input network data subjected to the destination address conversion is transmitted to the target second network card.
In some other embodiments, determining the source address corresponding to the target second network card according to the identification information includes: searching a source address corresponding to the identification information in a second network card address corresponding table according to the identification information to determine a source address corresponding to the target second network card; the second network card address corresponding table stores the corresponding relationship between the identification information and the source address corresponding to the second network card. Therefore, the source address corresponding to the target second network card is accurately determined.
In this embodiment, after counting the identification information carried by the output network data, the first system establishes a second network card address correspondence table, and establishes a correspondence between each identification information and each second network card, so that after the input network data comes, the corresponding second network card and the source address thereof can be directly found through the second network card address correspondence table.
In some other embodiments, the output network data carries an output time of the output network data; converting the source address of the output network data into a source address corresponding to the first network card to obtain the converted output network data, including: determining a source address corresponding to the first network card according to the output time; the source addresses corresponding to the first network cards are the same at the same time, and the source addresses corresponding to the first network cards are different at different times; and converting the source address of the output network data into the source address corresponding to the first network card to obtain the converted output network data. Therefore, the source address can be dynamically converted, so that the use cost and the maintenance cost are reduced.
In a specific application scenario, the SNAT in a general fixed source address translation, no matter a few addresses, must explicitly specify the IP address of the SNAT to be used. If the current system uses ADSL dynamic dialing mode, the outlet IP address changes with a large change amplitude every dialing, however, the converted source address IP must be consistent with the outlet IP or fluctuate within a small range to establish a good connection, for example, the outlet IP is 192.168.5.3, and the source address converted IP address is generally an address in the range of 192.168.5.3 to 192.168.5.5, which is a problem if it is configured in a fixed source address conversion mode. Because the server address changes after each dialing, the IP address converted by the fixed source address cannot change along with the automatic change, the IP address must be manually modified once after each address change, and the fixed IP address in the rule is changed into a new IP address, which is very inconvenient and can increase the use cost and the maintenance cost. Therefore, in this embodiment, the output time of the output network data is determined, so as to determine the source address corresponding to the first network card at the output time, and address conversion is performed through the source address. In a specific application scenario, dynamic source address conversion as in this embodiment may be performed through masquerade.
In some other embodiments, converting the source address of the output network data into the source address corresponding to the first network card to obtain the converted output network data includes: acquiring a source address list corresponding to a first network card; a plurality of source addresses corresponding to the first network card are stored in the source address list; and converting the source address of the output network data into any one source address in the source address list to obtain the converted output network data. Therefore, the conversion speed of source address target conversion is increased, and the network data interaction can be carried out on the output network data more quickly.
Although the fixed source address translation approach has certain problems, as described in the previous embodiment, it is generally only fluctuating within a certain range, even by dynamic dialing, as it is used on a daily basis. Therefore, in order to accelerate the interaction speed, a source address list can be set to record a common IP address, so that the source address can be directly used during conversion, and the reaction speed is improved. That is, in this embodiment, the source address list is a list recording one or more commonly used source addresses corresponding to the first network card, and after the output network data is obtained, one source address is randomly selected according to the source addresses recorded in the source address list to perform fast source address target conversion, so that the conversion speed is increased.
In some other embodiments, before acquiring the output network data transmitted from the second network card to the first network card, the method further includes: activating the first network card to enable the first system to perform network interaction through the first network card; and activating the second network card, acquiring the routing information of the second network card, and writing the routing information into the first network card so as to establish a data communication channel between the first network card and the second network card. Therefore, the communication relation between the first network card and the second network card is effectively established.
In this embodiment, the first network card corresponding to the first system is activated first, so that the first system can perform operations such as normal internet access and network data interaction according to a normal program. The first system can be used for surfing the internet in a wired or wireless mode, that is, the first network card can be a wired network card or a wireless network card. Later, the type of the second network card is not specifically limited, but in order to save cost, a more economical wired network card is generally selected as the second network card. In order to achieve the purpose of network sharing, first, routing information (routing) of the second network card needs to be obtained in advance, where the routing information (routing) is a process for determining a network range of an end-to-end path when a packet is from a source to a destination. Each network card is corresponding to its own routing information for establishing a network connection channel. In the scheme, the routing information of the second network card is written into the first network card so as to establish a data channel between the two network cards.
Based on the same concept, the application also provides a network sharing device corresponding to the method of any embodiment.
Referring to fig. 3, the network sharing apparatus is applied to an intelligent device, the intelligent device is provided with a first system and a second system that are in communication connection, the first system includes a first network card, and the second system includes a second network card;
a network sharing apparatus comprising:
an obtaining module 310, configured to obtain output network data transmitted from the second network card to the first network card;
the conversion module 320 is configured to convert a source address of the output network data into a source address corresponding to the first network card, so as to obtain converted output network data;
the output module 330 is configured to send the converted output network data to the first network card, so that the first network card sends the converted output network data to an external network.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, the functions of the modules may be implemented in the same or multiple software and/or hardware when implementing the embodiments of the present application.
The apparatus in the foregoing embodiment is used to implement the corresponding network sharing method in the foregoing embodiment, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
As an alternative embodiment, the output module 330 is further configured to:
acquiring input network data transmitted to a first network card by an external network; the input network data is network data generated by the external network in response to the converted output network data;
converting the destination address of the input network data into a source address corresponding to the second network card to obtain converted input network data;
and transmitting the converted input network data to a second network card.
As an optional embodiment, the number of the second systems is multiple, and each second system includes a corresponding second network card; the output network data carries the identification information of the second network card;
an output module 330, further configured to:
determining a source address corresponding to the target second network card according to the identification information; the target second network card is a second network card for transmitting and outputting network data;
converting the destination address of the input network data into a source address corresponding to the target second network card to obtain converted input network data;
transmitting the converted input network data to a second network card, comprising:
and transmitting the converted input network data to the target second network card.
As an alternative embodiment, the output module 330 is further configured to:
searching a source address corresponding to the identification information in a second network card address corresponding table according to the identification information to determine a source address corresponding to the target second network card; the second network card address corresponding table stores the corresponding relationship between the identification information and the source address corresponding to the second network card.
As an alternative embodiment, the output network data carries an output time of the output network data;
a conversion module 320, further configured to:
determining a source address corresponding to the first network card according to the output time; the source addresses corresponding to the first network cards are the same at the same time, and the source addresses corresponding to the first network cards are different at different times;
and converting the source address of the output network data into the source address corresponding to the first network card to obtain the converted output network data.
As an alternative embodiment, the converting module 320 is further configured to:
acquiring a source address list corresponding to a first network card; a plurality of source addresses corresponding to the first network card are stored in the source address list;
and converting the source address of the output network data into any one source address in the source address list to obtain the converted output network data.
As an alternative embodiment, the obtaining module 310 is further configured to:
activating the first network card to enable the first system to perform network interaction through the first network card;
and activating the second network card, acquiring the routing information of the second network card, and writing the routing information into the first network card so as to establish a data communication channel between the first network card and the second network card.
Based on the same concept, corresponding to the method of any embodiment described above, the present application further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the network sharing method described in any embodiment above is implemented.
Fig. 4 is a schematic diagram illustrating a more specific hardware structure of an electronic device according to this embodiment, where the electronic device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein the processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 are communicatively coupled to each other within the device via bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, or the like. The memory 1020 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 1020 and called to be executed by the processor 1010.
The input/output interface 1030 is used for connecting an input/output module to input and output information. The i/o module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 1040 is used for connecting a communication module (not shown in the drawings) to implement communication interaction between the present apparatus and other apparatuses. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
It should be noted that although the above-mentioned device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040 and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, those skilled in the art will appreciate that the above-described apparatus may also include only those components necessary to implement the embodiments of the present description, and not necessarily all of the components shown in the figures.
The electronic device of the foregoing embodiment is used to implement the corresponding network sharing method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the network sharing method according to any of the above-mentioned embodiments.
Computer-readable media of the present embodiments, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
The computer instructions stored in the storage medium of the foregoing embodiment are used to enable the computer to execute the network sharing method according to any one of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which are not described herein again.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, is limited to these examples; within the context of the present application, features from the above embodiments or from different embodiments may also be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of brevity.
In addition, well-known power/ground connections to Integrated Circuit (IC) chips and other components may or may not be shown in the provided figures for simplicity of illustration and discussion, and so as not to obscure the embodiments of the application. Furthermore, devices may be shown in block diagram form in order to avoid obscuring embodiments of the application, and this also takes into account the fact that specifics with respect to implementation of such block diagram devices are highly dependent upon the platform within which the embodiments of the application are to be implemented (i.e., specifics should be well within purview of one skilled in the art). Where specific details (e.g., circuits) are set forth in order to describe example embodiments of the application, it should be apparent to one skilled in the art that the embodiments of the application can be practiced without, or with variation of, these specific details. Accordingly, the description is to be regarded as illustrative instead of restrictive.
While the present application has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic ram (dram)) may use the discussed embodiments.
The present embodiments are intended to embrace all such alternatives, modifications and variances which fall within the broad scope of the appended claims. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present application are intended to be included within the scope of the present application.
Claims (10)
1. A network sharing method is characterized in that the method is applied to intelligent equipment, the intelligent equipment is provided with a first system and a second system which are in communication connection, the first system comprises a first network card, and the second system comprises a second network card;
the method comprises the following steps:
acquiring output network data transmitted from the second network card to the first network card;
converting the source address of the output network data into a source address corresponding to the first network card to obtain converted output network data;
and sending the converted output network data to the first network card so that the first network card sends the converted output network data to an external network.
2. The method of claim 1, wherein after sending the converted output network data to the first network card, the method further comprises:
acquiring input network data transmitted from the external network to the first network card; the input network data is network data generated by the external network in response to the converted output network data;
converting the destination address of the input network data into a source address corresponding to the second network card to obtain converted input network data;
and transmitting the converted input network data to the second network card.
3. The method according to claim 2, wherein the number of the second systems is plural, and each second system comprises a corresponding second network card; the output network data carries identification information of the second network card;
the converting the destination address of the input network data into the source address corresponding to the second network card to obtain the converted input network data includes:
determining a source address corresponding to the target second network card according to the identification information; the target second network card is a second network card for transmitting the output network data;
converting the destination address of the input network data into a source address corresponding to the target second network card to obtain converted input network data;
the transmitting the converted input network data to the second network card includes:
and transmitting the converted input network data to the target second network card.
4. The method according to claim 3, wherein the determining a source address corresponding to the target second network card according to the identification information includes:
searching a source address corresponding to the identification information in a second network card address corresponding table according to the identification information to determine the source address corresponding to the target second network card; and the second network card address corresponding table stores the corresponding relationship between the identification information and the source address corresponding to the second network card.
5. The method of claim 1, wherein the outgoing network data carries an outgoing time of the outgoing network data;
the converting the source address of the output network data into the source address corresponding to the first network card to obtain the converted output network data includes:
determining a source address corresponding to the first network card according to the output time; the source addresses corresponding to the first network card are the same at the same time, and the source addresses corresponding to the first network card are different at different times;
and converting the source address of the output network data into the source address corresponding to the first network card to obtain the converted output network data.
6. The method according to claim 1, wherein the converting a source address of the output network data into a source address corresponding to the first network card to obtain the converted output network data comprises:
acquiring a source address list corresponding to the first network card; a plurality of source addresses corresponding to the first network card are stored in the source address list;
and converting the source address of the output network data into any one source address in the source address list to obtain the converted output network data.
7. The method according to claim 1, wherein before acquiring the output network data transmitted from the second network card to the first network card, the method further comprises:
activating the first network card to enable the first system to perform network interaction through the first network card;
and activating the second network card, acquiring routing information of the second network card, and writing the routing information into the first network card so as to establish a data communication channel between the first network card and the second network card.
8. A network sharing device is characterized by being applied to intelligent equipment, wherein the intelligent equipment is provided with a first system and a second system which are in communication connection, the first system comprises a first network card, and the second system comprises a second network card;
the apparatus, comprising:
the acquisition module is used for acquiring output network data transmitted from the second network card to the first network card;
the conversion module is used for converting the source address of the output network data into the source address corresponding to the first network card to obtain the converted output network data;
and the output module is used for sending the converted output network data to the first network card so that the first network card sends the converted output network data to an external network.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 7 when executing the program.
10. A non-transitory computer readable storage medium storing computer instructions for causing a computer to implement the method of any one of claims 1 to 7.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110990808.9A CN113886323A (en) | 2021-08-26 | 2021-08-26 | Network sharing method and device, electronic equipment and storage medium |
PCT/CN2021/142556 WO2023024382A1 (en) | 2021-08-26 | 2021-12-29 | Network sharing method and apparatus, and electronic device and computer-readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110990808.9A CN113886323A (en) | 2021-08-26 | 2021-08-26 | Network sharing method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113886323A true CN113886323A (en) | 2022-01-04 |
Family
ID=79011189
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110990808.9A Pending CN113886323A (en) | 2021-08-26 | 2021-08-26 | Network sharing method and device, electronic equipment and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113886323A (en) |
WO (1) | WO2023024382A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2024179413A1 (en) * | 2023-02-28 | 2024-09-06 | 华为技术有限公司 | Network sharing method, electronic device, and computer storage medium |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116567109A (en) * | 2023-05-31 | 2023-08-08 | 曙光云计算集团有限公司 | Message transmission method and device, electronic equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140258390A1 (en) * | 2009-12-23 | 2014-09-11 | Citrix Systems, Inc. | Systems and methods for maintaining transparent end to end cache redirection |
CN107770078A (en) * | 2017-10-13 | 2018-03-06 | 广州视源电子科技股份有限公司 | Interactive intelligent panel, data transmission method and device and storage medium |
CN111405367A (en) * | 2020-03-11 | 2020-07-10 | 海信视像科技股份有限公司 | Method for network sharing of system component based on multi-network switching scene and display equipment |
CN112187549A (en) * | 2020-10-12 | 2021-01-05 | 深圳康佳电子科技有限公司 | Network sharing method, terminal and storage medium |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6778528B1 (en) * | 2000-05-17 | 2004-08-17 | Cisco Technology, Inc. | Dial-out with dynamic IP address assignment |
CN102957754A (en) * | 2011-08-22 | 2013-03-06 | 中国电信股份有限公司 | Operating-level network address conversion method, operating-level network address conversion equipment and network system |
CN103618801B (en) * | 2013-12-09 | 2017-01-04 | 中国联合网络通信集团有限公司 | Method, equipment and the system of a kind of P2P resource-sharing |
CN106331815B (en) * | 2015-07-01 | 2019-07-12 | 青岛海信电器股份有限公司 | A kind of method for routing and combination tv of combination tv |
CN107071075B (en) * | 2016-11-16 | 2020-07-21 | 国家数字交换系统工程技术研究中心 | Device and method for dynamically jumping network address |
CN111756636B (en) * | 2019-03-29 | 2022-05-31 | 杭州海康威视数字技术股份有限公司 | Data packet processing method, device and equipment and storage medium |
-
2021
- 2021-08-26 CN CN202110990808.9A patent/CN113886323A/en active Pending
- 2021-12-29 WO PCT/CN2021/142556 patent/WO2023024382A1/en unknown
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140258390A1 (en) * | 2009-12-23 | 2014-09-11 | Citrix Systems, Inc. | Systems and methods for maintaining transparent end to end cache redirection |
CN107770078A (en) * | 2017-10-13 | 2018-03-06 | 广州视源电子科技股份有限公司 | Interactive intelligent panel, data transmission method and device and storage medium |
CN111405367A (en) * | 2020-03-11 | 2020-07-10 | 海信视像科技股份有限公司 | Method for network sharing of system component based on multi-network switching scene and display equipment |
CN112187549A (en) * | 2020-10-12 | 2021-01-05 | 深圳康佳电子科技有限公司 | Network sharing method, terminal and storage medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2024179413A1 (en) * | 2023-02-28 | 2024-09-06 | 华为技术有限公司 | Network sharing method, electronic device, and computer storage medium |
Also Published As
Publication number | Publication date |
---|---|
WO2023024382A1 (en) | 2023-03-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11151010B2 (en) | Resource configuration method, mobile terminal and storage medium | |
CN107635027B (en) | Domain name resolution method, medium, device and computing equipment | |
US9848333B2 (en) | Method supporting wireless access to storage device, and mobile routing hotspot device | |
CN113535721B (en) | Data writing method and device | |
CN113886323A (en) | Network sharing method and device, electronic equipment and storage medium | |
US10623469B2 (en) | Methods and apparatuses for information transmission | |
US20170289243A1 (en) | Domain name resolution method and electronic device | |
CN104756080A (en) | Augmenting capabilities of a host device | |
CN111064804B (en) | Network access method and device | |
CN109379742A (en) | Access method, device and storage medium of wireless local area network | |
US8972968B1 (en) | Alternate service for applications | |
EP3805938A1 (en) | Server node selection method and terminal device | |
CN112866439A (en) | Data processing method, device and system | |
CN113179295A (en) | Message processing method and device | |
CN112749015A (en) | Load balancing method and device | |
CN105991683A (en) | Data transmission method and device | |
CN109905486B (en) | Application program identification display method and device | |
CN108563492B (en) | Data acquisition method, virtual machine and electronic equipment | |
CN115021831A (en) | Weak network testing method, device, system, equipment and storage medium | |
CN114928556A (en) | Interface service test method and related equipment | |
CN112040023B (en) | Object access method and device, electronic equipment and machine-readable storage medium | |
CN113727208A (en) | Communication method, device, equipment and medium for quickly reading and writing parameter information of optical module | |
CN105335682A (en) | Resource synchronous playing method and system and server | |
US10560727B2 (en) | Server structure for supporting multiple sessions of virtualization | |
CN113901374A (en) | Webpage refreshing 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 |