CN112333733B - Network connection establishing method and electronic equipment - Google Patents

Network connection establishing method and electronic equipment Download PDF

Info

Publication number
CN112333733B
CN112333733B CN202011216409.9A CN202011216409A CN112333733B CN 112333733 B CN112333733 B CN 112333733B CN 202011216409 A CN202011216409 A CN 202011216409A CN 112333733 B CN112333733 B CN 112333733B
Authority
CN
China
Prior art keywords
network
address
network card
card
wired
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011216409.9A
Other languages
Chinese (zh)
Other versions
CN112333733A (en
Inventor
宋建辉
李诗琪
叶志龙
江秀峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital 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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN202011216409.9A priority Critical patent/CN112333733B/en
Publication of CN112333733A publication Critical patent/CN112333733A/en
Application granted granted Critical
Publication of CN112333733B publication Critical patent/CN112333733B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/02Arrangements for optimising operational condition
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W88/00Devices specially adapted for wireless communication networks, e.g. terminals, base stations or access point devices
    • H04W88/14Backbone network devices

Abstract

The embodiment of the invention provides a network connection establishing method and electronic equipment, wherein the method is applied to the electronic equipment, the electronic equipment comprises a plurality of operating systems, each operating system is provided with a wired network card, a target system is also provided with a wireless network card and a network bridge, the network bridge corresponds to a virtual network card, the wired network card of the target system is respectively connected with the wired network cards of other operating systems through a network switching module, a first port of the network bridge is connected with the wireless network card, a second port of the network bridge is connected with the wired network card of the target system, and a third port of the network bridge is connected with the virtual network card, and the method comprises the following steps: the target system is connected with external wireless network equipment through a virtual network card, a network bridge and a wireless network card; and the other operating systems are respectively connected with external wireless network equipment through the wired network card, the network switching module, the target wired network card, the network bridge and the wireless network card of the other operating systems. And other operating systems are transparently transmitted to the wireless network card through the wired network card of the target system to establish network connection with external wireless network equipment.

Description

Network connection establishing method and electronic equipment
Technical Field
The present invention relates to the field of network connection technologies, and in particular, to a method for establishing a network connection and an electronic device.
Background
Currently, electronic devices are generally divided into single operating system devices and multiple operating system devices, and for the multiple operating system devices, the multiple operating system devices generally have a main control system, for example, the main control system may be an Android (Android) system. The main control system is provided with a wireless network card, and other systems establish network connection with external wireless network equipment through the wireless network card of the main control system so as to carry out wireless internet access.
Specifically, in the first mode, as shown in fig. 1(a), a Wireless wifi of the system 1 is connected to an AP (Wireless Access Point) hotspot of the Android system, and the Android system is connected to the Wireless network through a Wireless network card according to a preset policy route. In the second mode, as shown in fig. 1(b), the wired network card of the system 1 is connected to the AP hotspot of the Android system, and the Android system is connected to the wireless network through the wireless network card according to a preset policy route. In the third mode, as shown in fig. 1(c), after the system 1 is driven by the RNDIS through a USB (Universal Serial Bus) interface and a USB interface of the Android system, the Android system is connected to the wireless network through the wireless network card according to a preset policy route. In the above manner, the system 1 and the Android system are networked through independent channels, the system 1 is equivalent to an intranet system of the Android system, and an external wireless network cannot sense the existence of the system 1.
For the multi-operating system device, besides the Android system, the multi-operating system device also has a plurality of operating systems, and wired network cards of the operating systems are respectively connected with the wired network card of the Android system. If the wireless Internet access is performed in the above manner, the plurality of operating systems are regarded as intranet systems of the Android system, and therefore, the problem of intranet IP (Internet Protocol) conflict among the plurality of systems occurs, and wireless Internet access cannot be achieved.
Disclosure of Invention
The embodiment of the invention aims to provide a network connection establishing method and electronic equipment, so as to realize the establishment of network connection between multi-system electronic equipment and external wireless network equipment. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a method for establishing a network connection, which is applied to an electronic device, where the electronic device includes multiple operating systems, each operating system is configured with a wired network card, a target system of the multiple operating systems is further configured with a wireless network card and a network bridge, the network bridge corresponds to a virtual network card, the wired network card of the target system is respectively connected with wired network cards of other operating systems, except the target operating system, of the multiple operating systems through a network switching module, a first port of the network bridge is connected with the wireless network card, a second port of the network bridge is connected with the wired network card of the target system, and a third port of the network bridge is connected with the virtual network card, and the method includes:
after the electronic equipment is started, the target system establishes network connection with external wireless network equipment through the virtual network card, the network bridge and the wireless network card so as to perform data transmission with the external wireless network equipment;
one or more operating systems in the other operating systems respectively establish network connection with external wireless network equipment through a wired network card of the operating system, the network switching module, a target wired network card, the network bridge and the wireless network card so as to perform data transmission with the external wireless network equipment, wherein the target wired network card is the wired network card configured in the target system.
Optionally, the establishing a network connection with an external wireless network device through the wired network card of the network, the network switching module, the target wired network card, the network bridge, and the wireless network card includes:
acquiring an IP address dynamically allocated by a Dynamic Host Configuration Protocol (DHCP) server in an external wireless network as a first IP address; or, acquiring a pre-configured static IP address as a first IP address;
and establishing network connection with the external wireless network equipment through the wired network card, the network switching module, the target wired network card, the network bridge and the wireless network card based on the first IP address and the MAC address of the network bridge.
Optionally, after the network connection is established between the first IP address and the MAC address of the network device and the external wireless network device through the wired network card of the network, the network switching module, the target wired network card, the network bridge, and the wireless network card, the method further includes:
a first operating system sends an access message to the network bridge through a wired network card of the first operating system, the network switching module and the target wired network card, wherein the first operating system is one of the other operating systems, and the access message carries a first IP address and an MAC address of the first operating system;
and the network bridge modifies the MAC address carried by the access message into the MAC address of the wireless network card, records the corresponding relation between the first IP address of the first operating system and the MAC address carried by the access message, and sends the modified access message to the external wireless network equipment through the wireless network card.
Optionally, after the network connection is established between the first IP address and the MAC address of the network device and the external wireless network device through the wired network card of the network, the network switching module, the target wired network card, the network bridge, and the wireless network card, the method further includes:
the network bridge receives a response message sent by the external wireless network equipment through the wireless network card, wherein the response message carries a second IP address and the MAC address of the wireless network card;
the network bridge determines a target MAC address corresponding to a second IP address carried by the response message based on the recorded corresponding relation between the IP address and the MAC address carried by the access message, and modifies the MAC address carried by the response message into the target MAC address;
and the network bridge sends the modified response message to a wired network card of a second operating system corresponding to the target MAC address through the target wired network card and the network switching module, wherein the second operating system is one of the other operating systems.
Optionally, the network switching module establishes network connection with an external wired network device; the method further comprises the following steps:
and one or more operating systems in the other operating systems are respectively connected with the external wired network equipment through the network switching module to transmit data with the external wired network equipment.
Optionally, the establishing a network connection with the external wired network device through the network switching module includes:
acquiring an IP address dynamically allocated by a DHCP server in an external wired network as a third IP address; or, acquiring a pre-configured static IP address as a third IP address;
and establishing network connection with the external wired network equipment through the network switching module based on the third IP address and the MAC address of the third IP address.
In a second aspect, an embodiment of the present invention provides an electronic device, where the electronic device includes multiple operating systems, each operating system is configured with a wired network card, a target system in the multiple operating systems is further configured with a wireless network card and a network bridge, the network bridge corresponds to a virtual network card, the wired network card of the target system is connected to wired network cables of other operating systems except the target operating system in the multiple operating systems through a network switching module, respectively, a first port of the network bridge is connected to the wireless network card, a second port of the network bridge is connected to the wired network card of the target system, and a third port of the network bridge is connected to the virtual network card, where:
the target system is used for establishing network connection with external wireless network equipment through the virtual network card, the network bridge and the wireless network card after the electronic equipment is started so as to perform data transmission with the external wireless network equipment;
and one or more operating systems in the other operating systems are respectively used for establishing network connection with external wireless network equipment through the wired network card, the network switching module, the target wired network card, the network bridge and the wireless network card of the operating system so as to perform data transmission with the external wireless network equipment, wherein the target wired network card is the wired network card configured in the target system.
Optionally, one or more operating systems of the other operating systems are specifically configured to acquire an IP address dynamically allocated by a DHCP server in an external wireless network, as the first IP address, or acquire a static IP address configured in advance, as the first IP address; and establishing network connection with the external wireless network equipment through the wired network card, the network switching module, the target wired network card, the network bridge and the wireless network card based on the first IP address and the MAC address of the network bridge.
Optionally, the first operating system is further configured to send an access packet to the network bridge through its own wired network card, the network switching module, and the target wired network card, where the first operating system is one of the other operating systems, and the access packet carries a first IP address and an MAC address of the first operating system;
the network bridge is further configured to modify the MAC address carried in the access packet into the MAC address of the wireless network card, record a corresponding relationship between the first IP address of the first operating system and the MAC address carried in the access packet, and send the modified access packet to the external wireless network device through the wireless network card.
Optionally, the network bridge is further configured to receive a response message sent by the external wireless network device through the wireless network card; determining a target MAC address corresponding to a second IP address carried by the response message based on the recorded corresponding relation between the IP address and the MAC address carried by the access message, and modifying the MAC address carried by the response message into the target MAC address; and sending the modified response message to the wired network card of the second operating system corresponding to the target MAC address through the target wired network card and the network switching module, wherein the response message carries the second IP address and the MAC address of the wireless network card, and the second operating system is one of the other operating systems.
Optionally, the network switching module establishes network connection with an external wired network device;
and one or more operating systems in the other operating systems are also respectively used for establishing network connection with the external wired network equipment through the network switching module so as to transmit data with the external wired network equipment.
Optionally, one or more operating systems of the other operating systems are specifically configured to acquire an IP address dynamically allocated by a DHCP server in an external wired network, as a third IP address, or acquire a preconfigured static IP address, as the third IP address; and establishing network connection with the external wired network equipment through the network switching module based on the third IP address and the MAC address of the third IP address.
The embodiment of the invention has the following beneficial effects:
in the scheme provided by the embodiment of the invention, the electronic device comprises a plurality of operating systems, each operating system is provided with a wired network card, a target system in the operating systems is also provided with a wireless network card and a network bridge, the network bridge corresponds to a virtual network card, the wired network card of the target system is respectively connected with wired network cables of other operating systems except the target operating system in the operating systems through a network switching module, a first port of the network bridge is connected with the wireless network card, a second port of the network bridge is connected with the wired network card of the target system, and a third port of the network bridge is connected with the virtual network card. After the electronic equipment is started, the target system establishes network connection with external wireless network equipment through the virtual network card, the network bridge and the wireless network card so as to perform data transmission with the external wireless network equipment, and one or more operating systems in other operating systems establish network connection with the external wireless network equipment through the wired network card, the network switching module, the target wired network card, the network bridge and the wireless network card of the operating system so as to perform data transmission with the external wireless network equipment, wherein the target wired network card is the wired network card configured in the target system. Therefore, for other operating systems, the network bridge in the target system is responsible for network forwarding, the other operating systems and the target system do not establish network connection, and an external wireless network can sense independent multiple operating systems, so that the problem of intranet IP conflict is avoided, and the purpose that the other operating systems establish network connection with external wireless network equipment through the wireless network card of the target system is achieved. Of course, not all of the advantages described above need to be achieved at the same time in the practice of any one product or method of the invention.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1(a) is a first schematic diagram of a manner of establishing a network connection in the related art;
fig. 1(b) is a second schematic diagram of a network connection establishment method in the related art;
fig. 1(c) is a third schematic diagram of a network connection establishment method in the related art;
FIG. 2 is a schematic structural diagram of a multi-OS device according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
fig. 4 is a flowchart of a method for establishing a network connection according to an embodiment of the present invention;
FIG. 5 is a flow chart of a manner of data transmission based on the embodiment shown in FIG. 4;
fig. 6 is a flowchart of a processing method of a response packet according to the embodiment shown in fig. 4.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
For the multi-os device shown in fig. 2, besides the main control system, there are multiple operating systems, which are represented by system 1-system n in fig. 2, where n is an integer greater than 1, and the wired network cards of the multiple operating systems are respectively connected to the wired network card of the main control system through a network switch. If the network connection mode in the related technology is adopted to carry out wireless internet access, the multiple operating systems are regarded as the intranet system of the main control system, and then the problem of intranet IP conflict occurs among the multiple systems.
In order to solve the above problems and achieve establishment of network connection between a multi-system electronic device and an external wireless network device, embodiments of the present invention provide a network connection establishment method and an electronic device. First, a method for establishing a network connection according to an embodiment of the present invention is described below.
The method for establishing a network connection provided by the embodiment of the present invention is applied to an electronic device, as shown in fig. 3, the electronic device includes a plurality of operating systems, each operating system is configured with a wired network card, a target system 310 of the plurality of operating systems is further configured with a wireless network card 320 and a network bridge 330, the network bridge 330 corresponds to a virtual network card 340, the wired network card 311 of the target system 310 is respectively connected with wired network cards 360 of other operating systems (represented by system 1-system n in fig. 3, where n is an integer greater than 1) except the target operating system of the plurality of operating systems through a network switching module 350, a first port 331 of the network bridge 330 is connected with the wireless network card 320, a second port 332 of the network bridge is connected with the wired network card 311 of the target system 310, and a third port 333 of the network bridge 330 is connected with the virtual network card 340.
As shown in fig. 4, a method for establishing a network connection is applied to an electronic device, and the method includes:
s401, after the electronic equipment is started, the target system establishes network connection with external wireless network equipment through the virtual network card, the network bridge and the wireless network card so as to perform data transmission with the external wireless network equipment;
s402, one or more operating systems in the other operating systems respectively establish network connection with external wireless network equipment through the wired network card, the network switching module, the target wired network card, the network bridge and the wireless network card of the operating system, so as to perform data transmission with the external wireless network equipment.
The target wired network card is a wired network card configured in the target system.
It can be seen that, in the scheme provided in the embodiment of the present invention, after the electronic device is started, the target system may establish a network connection with the external wireless network device through the virtual network card, the network bridge, and the wireless network card to perform data transmission with the external wireless network device, and one or more operating systems in the other operating systems respectively establish a network connection with the external wireless network device through their own wired network card, the network switching module, the target wired network card, the network bridge, and the wireless network card to perform data transmission with the external wireless network device, where the target wired network card is a wired network card configured in the target system. Therefore, for other operating systems, the network bridge in the target system is responsible for network forwarding, the other operating systems and the target system do not establish network connection, and an external wireless network can sense independent multiple operating systems, so that the problem of intranet IP conflict is avoided, and the purpose that the other operating systems establish network connection with external wireless network equipment through the wireless network card of the target system is achieved.
In the electronic device, in order to achieve the purpose that other operating systems pass through the wired network card of the target system to the wireless network card to establish network connection with the external wireless network device, and at the same time, the network connection of the target system is not affected, a network bridge may be set in the target system, where the network bridge may be regarded as a software-simulated switch, and may be used to forward a message. The target system may be an operating system capable of configuring a network bridge, such as Android, iOS, Linux, Windows, and the like, and a specific configuration manner of the network bridge may be any network bridge configuration manner in the related art, which is not specifically limited and described herein.
The other operating systems except the target operating system in the plurality of operating systems may also be Android, iOS, Linux, Windows, and other operating systems, which are not limited herein. For example, the target system is Android, and other operating systems may be Linux; the target system is Android, and other operating systems can be Windows; the target system is iOS, other operating systems may be Linux, etc.
The wireless network is a network that uses air as a transmission medium and relies on electromagnetic waves, infrared rays and the like as carriers to transmit data, such as wifi, 4G, 5G networks and the like. The external wireless network device is other network devices in the wireless network except the electronic device.
After the target system is configured with the network bridge, a virtual network card can be virtualized, the network bridge can be provided with 3 ports, a first port of the network bridge can be connected with a wireless network card of the target system, a second port of the network bridge can be connected with a wired network card of the target system, and a third port of the network bridge can be connected with the virtual network card. Therefore, a virtual local area network can be formed by the connection of the three ports, the three ports can be communicated with each other, and the target system can establish network connection with external wireless network equipment through the virtual network card, the network bridge and the wireless network card so as to perform data transmission with the external wireless network equipment.
For one or more operating systems in other operating systems, the network bridge functions as a switch, so that the other operating systems can establish network connection with external wireless network devices through their own wired network cards, network switching modules, wired network cards configured in the target system, the network bridge, and wireless network cards of the target system, respectively, and further the other operating systems can perform data transmission with the external wireless network devices. For convenience of description, the wired network card configured in the target system may be referred to as a target wired network card.
In one embodiment, the wired network card of the other operating system is connected to the network switching module, the network switching module is connected to the wired network card configured in the target system, the wired network card in the target system is connected to the network bridge, and the network bridge is connected to the wireless network card of the target system, and the wireless network card can establish communication connection with the external wireless network device, so that the other operating system can establish network connection with the external wireless network device through the wired network card of the other operating system, the network switching module, the wired network card configured in the target system, the network bridge, and the wireless network card of the target system.
In this way, because other operating systems do not establish independent network connection with the target system, wireless network connection is realized only through the network bridge and the wireless network card configured in the target system. For an external wireless network, the target system and other operating systems are independent, so that the problem of intranet IP conflict is avoided, and the purpose that other operating systems establish network connection with external wireless network equipment through the wireless network card of the target system is achieved.
As an implementation manner of the embodiment of the present invention, as shown in fig. 5, the establishing a network connection with an external wireless network device through the wired network card of the network, the network switching module, the target wired network card, the network bridge, and the wireless network card may include:
s501, acquiring an IP address dynamically allocated by a DHCP server in an external wireless network as a first IP address; or, acquiring a pre-configured static IP address as a first IP address;
in an embodiment, since a DHCP (Dynamic Host Configuration Protocol) server may function to centrally manage and allocate IP addresses, a Host in a network environment dynamically obtains information such as IP addresses, Gateway addresses, and domain name server addresses, and the utilization rate of the addresses can be improved. Therefore, if the external wireless network has the DHCP server, the other operating system may acquire the IP address dynamically allocated by the DHCP server in the external wireless network as the first IP address.
In another embodiment, if the external wireless network does not have a DHCP server, a static IP address pre-configured for other operating systems may be used as the first IP address.
S502, based on the first IP address and the MAC address thereof, network connection is established with the external wireless network equipment through the wired network card thereof, the network switching module, the target wired network card, the network bridge and the wireless network card.
Furthermore, other operating systems can establish network connection with the external wireless network device through their own wired network card, network switching module, target wired network card, network bridge and wireless network card based on their own IP Address (i.e. first IP Address) and their own MAC Address (Media Access Control Address). After the network connection is established, data transmission can be performed with external wireless network devices, wherein the MAC addresses of other operating systems can be the MAC addresses of their own wired network cards.
As can be seen, in this embodiment, one or more operating systems in other operating systems may respectively obtain an IP address dynamically allocated by a DHCP server in an external wireless network, or obtain a pre-configured static IP address as a first IP address, and then establish a network connection with an external wireless network device through its own wired network card, network switching module, target wired network card, network bridge, and wireless network card based on the IP address and its own MAC address. In this way, no matter whether the external wireless network has the DHCP server or not, one or more operating systems in other operating systems can smoothly establish network connection with the external wireless network equipment.
As an implementation manner of the embodiment of the present invention, after the network connection is established with the external wireless network device through the wired network card of the network, the network switching module, the target wired network card, the network bridge, and the wireless network card based on the first IP address and the MAC address of the network bridge, the method may further include:
the first operating system sends an access message to the network bridge through the wired network card of the first operating system, the network switching module and the target wired network card; and the network bridge modifies the MAC address carried by the access message into the MAC address of the wireless network card, records the corresponding relation between the first IP address and the MAC address, and sends the modified access message to the external wireless network equipment through the wireless network card.
The first operating system is one of other operating systems, and in the process of establishing network connection with external wireless network equipment for data transmission, the first operating system can send an access message to the network bridge through the wired network card, the network switching module and the target wired network card. The access message carries a first IP address and an MAC address of the first operating system to identify which operating system sent the access message.
Since the external wireless network device is only connected with the wireless network card of the target system, the external wireless network device only processes the network message sent by the wireless network card of the target system, that is, the external wireless network device only processes the network message of which the source MAC address is the MAC address of the wireless network card of the target system.
Therefore, after receiving the access message sent by the first operating system, the network bridge can modify the MAC address carried in the access message into the MAC address of the wireless network card of the target system, and send the modified access message to the external wireless network device through the wireless network card, so that the external wireless network device can receive the access message, process the modified access message, and return a response message.
In order to determine which operating system actually sends the modified access message, the network bridge may record a corresponding relationship between the first IP address and the MAC address of the first operating system carried in the access message, so as to perform forwarding processing when receiving the response message subsequently.
As can be seen, in this embodiment, the first operating system may send the access packet to the network bridge through its own wired network card, the network switching module, and the target wired network card, and then the network bridge may modify the MAC address carried in the access packet into the MAC address of the wireless network card, record the corresponding relationship between the first IP address and the MAC address carried in the access packet, and send the modified access packet to the external wireless network device through the wireless network card. Therefore, data transmission with external wireless network equipment can be smoothly realized.
As an implementation manner of the embodiment of the present invention, as shown in fig. 6, after the network connection is established with the external wireless network device through the wired network card of the network, the network switching module, the target wired network card, the network bridge, and the wireless network card based on the first IP address and the MAC address of the network bridge, the method may further include:
s601, the network bridge receives a response message sent by the external wireless network equipment through the wireless network card;
in an embodiment, after processing the access packet, the external wireless network device returns a response packet, and the network bridge may receive the response packet sent by the external wireless network device through the wireless network card. In another embodiment, the access message may also be a message that is actively sent to the target system by the external wireless network device. Because the external wireless network device is only connected with the wireless network card of the target system, the external wireless network device only returns a response message to the wireless network card of the target system, and the MAC address carried by the response message is the MAC address of the wireless network card. Certainly, the response packet may also carry an IP address of another operating system that sends the access packet, or an IP address of an operating system to which the response packet actively sent by the external wireless network device is directed, that is, the second IP address.
S602, the network bridge determines a target MAC address corresponding to the second IP address carried by the response message based on the recorded corresponding relation between the IP address and the MAC address carried by the access message, and modifies the MAC address carried by the response message into the target MAC address;
in order to determine to which operating system the response packet should be forwarded, the bridge may determine, based on the recorded correspondence between the IP address and the MAC address carried in the access packet, a target MAC address corresponding to the second IP address carried in the response packet.
As an implementation manner, the correspondence between the recorded IP address and the MAC address carried in the access packet may be recorded in a form of a table. For example, it can be shown in the following table:
serial number IP address MAC address carried by access message
1 IP address 1 MAC address a
2 IP address 2 MAC address b
3 IP address 3 MAC address c
4 IP address 4 MAC address d
Then, if the second IP address carried in the response packet is IP address 3, based on the above correspondence, the bridge may determine that the target MAC address corresponding to IP address 3 is MAC address c. Further, the bridge may modify the MAC address carried in the response packet to MAC address c.
S603, the network bridge sends the modified response message to the wired network card of the second operating system corresponding to the target MAC address through the target wired network card and the network switching module.
After the MAC address carried in the modified response message is the target MAC address, the network bridge may send the modified response message to the wired network card of the second operating system corresponding to the target MAC address through the target wired network card and the network switching module, thereby completing the data transmission. The second operating system is one of other operating systems, and the second operating system is an operating system that actually sends out an access message or an operating system that is targeted by a response message actively sent by an external wireless network device.
As can be seen, in this embodiment, the network bridge receives a response message sent by the external wireless network device through the wireless network card, then determines a target MAC address corresponding to the second IP address carried in the response message based on the recorded correspondence between the IP address and the MAC address carried in the access message, modifies the MAC address carried in the response message into the target MAC address, and sends the modified response message to the wired network card of the second operating system corresponding to the target MAC address through the target wired network card and the network switching module, so as to implement data transmission between the second operating system and the external wireless network device.
As an implementation manner of the embodiment of the present invention, the network switching module may establish a network connection with an external wired network device. That is, the electronic device may be connected not only to a wireless network but also to a wired network. The wired network is a network connected by coaxial cables, twisted pairs, optical fibers, and the like. For example, it may be a network of rj45 headers, etc. For this case, the method may further include:
and the other operating systems respectively establish network connection with the external wired network equipment through the network switching module so as to transmit data with the external wired network equipment.
Because the network switching module establishes network connection with the external wired network device, one or more operating systems in other operating systems can establish network connection with the external wired network device through the network switching module respectively, and further transmit data with the external wired network device. The external wired network device is other network devices except the electronic device in the wired network.
It can be seen that, in this embodiment, one or more operating systems in the other operating systems respectively establish network connection with the external wired network device through the network switching module to transmit data with the external wired network device, so that the electronic device can also implement wired internet while implementing wireless internet.
As an implementation manner of the embodiment of the present invention, the establishing a network connection with the external wired network device through the network switching module may include:
acquiring an IP address dynamically allocated by a DHCP server in an external wired network as a third IP address; or, acquiring a pre-configured static IP address as a third IP address; and establishing network connection with the external wired network equipment through the network switching module based on the third IP address and the MAC address of the third IP address.
If the external wired network has the DHCP server, the other operating systems may acquire the IP address dynamically allocated by the DHCP server in the external wired network as the third IP address. If the external wired network does not have the DHCP server, a static IP address which is configured in advance for other operating systems can be used as the third IP address.
Furthermore, one or more operating systems of the other operating systems may establish network connection with the external wired network device through the network switching module based on the third IP address and the MAC address of the operating system. After the network connection is established, data transmission can be carried out with external wired network equipment. The specific data transmission mode may be any mode for data transmission between network devices in a wired network, and is not specifically limited herein.
In one embodiment, the wired network card in the other operating system may be connected to the network switching module, so that a network connection may be established with the external wired network device based on the third IP address and its own MAC address.
It can be seen that, in this embodiment, one or more operating systems in other operating systems may respectively obtain an IP address dynamically allocated by a DHCP server in an external wired network, or obtain a pre-configured static IP address as a third IP address, and further establish a network connection with an external wired network device through a network switching module based on the third IP address and its own MAC address. Therefore, no matter whether the external wired network is provided with the DHCP server or not, other operating systems can smoothly establish network connection with the external wired network equipment.
As an implementation manner of the embodiment of the present invention, the method may further include:
and the target system acquires the network connection instruction and controls the target system and the other operating systems to carry out network connection based on the network connection mode indicated by the network connection instruction.
The network connection instruction may carry an identifier of a network connection mode, where the network connection mode includes a wireless network connection and a wired network connection. The identifier of the network connection mode may be any identifier capable of uniquely representing the network connection mode, and may be characters such as numbers and letters, which are not specifically limited herein. For example, the identity of the wireless network connection may be 1 and the identity of the wired network connection may be 0.
In an embodiment, the network connection instruction may be generated when a user triggers a network connection button displayed by the electronic device, and the target system may acquire the network connection instruction. In another embodiment, the network connection instruction may be generated when the current time meets a preset time condition, for example, the preset time condition is that the electronic device network connection mode in the time period a is wireless network connection, and the electronic device network connection mode in the time period B is wired network connection, then the indicated network connection mode that may be generated when the current time belongs to the time period a is a network connection instruction of wireless network connection, and the indicated network connection mode that may be generated when the current time belongs to the time period B is a network connection instruction of wired network connection.
Furthermore, the target system can control itself and other operating systems to perform wireless network connection or wired network connection based on the network connection mode indicated by the network connection instruction. The specific manner of wireless network connection and wired network connection has been described in the above embodiments, and is not described herein again.
Therefore, in this embodiment, the target system may obtain the network connection instruction, and control itself and other operating systems to perform network connection based on the network connection mode indicated by the network connection instruction, so that the network connection mode of the electronic device may be dynamically managed and controlled by the user, and the network connection mode of the electronic device is more flexible and controllable.
Corresponding to the above method for establishing network connection, an embodiment of the present invention provides an electronic device, as shown in fig. 3, the electronic device includes a plurality of operating systems, each operating system is configured with a wired network card, a target system 310 of the plurality of operating systems is further configured with a wireless network card 320 and a network bridge 330, the network bridge 330 corresponds to a virtual network card 340, the wired network card 311 of the target system 310 is respectively connected with the wired network cards 360 of the other operating systems except the target operating system of the plurality of operating systems through a network switching module 350, a first port 331 of the network bridge 330 is connected with the wireless network card 320, a second port 332 of the network bridge is connected with the wired network card 311 of the target system 310, and a third port 333 of the network bridge 330 is connected with the virtual network card 340. Wherein:
the target system 310 is configured to establish a network connection with an external wireless network device through the virtual network card 340, the network bridge 330, and the wireless network card 320 after the electronic device is started, so as to perform data transmission with the external wireless network device;
one or more operating systems of the other operating systems are respectively configured to establish network connection with an external wireless network device through its own wired network card 360, the network switching module 350, the target wired network card 311, the network bridge 330, and the wireless network card 320, so as to perform data transmission with the external wireless network device.
The target wired network card 311 is a wired network card configured in the target system 310.
In the scheme provided by the embodiment of the invention, the electronic device comprises a plurality of operating systems, each operating system is provided with a wired network card, a target system in the operating systems is also provided with a wireless network card and a network bridge, the network bridge corresponds to a virtual network card, the wired network card of the target system is respectively connected with wired network cables of other operating systems except the target operating system in the operating systems through a network switching module, a first port of the network bridge is connected with the wireless network card, a second port of the network bridge is connected with the wired network card of the target system, and a third port of the network bridge is connected with the virtual network card. And the target system is used for establishing network connection with external wireless network equipment through the virtual network card, the network bridge and the wireless network card after the electronic equipment is started so as to perform data transmission with the external wireless network equipment, one or more operating systems in other operating systems are respectively used for establishing network connection with the external wireless network equipment through the wired network card, the network switching module, the target wired network card, the network bridge and the wireless network card of the target system so as to perform data transmission with the external wireless network equipment, and the target wired network card is a wired network card configured in the target system. Therefore, for other operating systems, the network bridge in the target system is responsible for network forwarding, the other operating systems and the target system do not establish network connection, and an external wireless network can sense independent multiple operating systems, so that the problem of intranet IP conflict is avoided, and the purpose that the other operating systems establish network connection with external wireless network equipment through the wireless network card of the target system is achieved.
As an implementation manner of the embodiment of the present invention, one or more operating systems of the other operating systems may be specifically configured to acquire an IP address dynamically allocated by a DHCP server in an external wireless network, as the first IP address, or acquire a static IP address configured in advance, as the first IP address; and establishing network connection with the external wireless network equipment through the wired network card, the network switching module, the target wired network card, the network bridge and the wireless network card based on the first IP address and the MAC address of the network bridge.
As an implementation manner of the embodiment of the present invention, the first operating system may be further configured to send an access message to the network bridge 330 through the wired network card 360 of the first operating system, the network switching module 350, and the target wired network card 311;
the first operating system is one of the other operating systems, and the access message carries a first IP address and an MAC address of the first operating system.
The network bridge 330 may be further configured to modify the MAC address carried in the access packet into the MAC address of the wireless network card 320, record a corresponding relationship between the first IP address of the first operating system and the MAC address carried in the access packet, and send the modified access packet to the external wireless network device through the wireless network card 320.
As an implementation manner of the embodiment of the present invention, the network bridge 330 may be further configured to receive a response message sent by the external wireless network device through the wireless network card 320; determining a target MAC address corresponding to a second IP address carried by the response message based on the recorded corresponding relation between the IP address and the MAC address carried by the access message, and modifying the MAC address carried by the response message into the target MAC address; and sending the modified response message to the wired network card 360 of the second operating system corresponding to the target MAC address through the target wired network card 311 and the network switching module 350.
The response message carries the second IP address and the MAC address of the wireless network card 320, and the second operating system is one of the other operating systems.
As an implementation manner of the embodiment of the present invention, the network switching module 350 may establish a network connection with an external wired network device;
one or more operating systems of the other operating systems may be further configured to establish a network connection with the external wired network device through the network switching module 350, so as to transmit data with the external wired network device.
As an implementation manner of the embodiment of the present invention, one or more operating systems of the other operating systems may be specifically configured to acquire an IP address dynamically allocated by a DHCP server in an external wired network, as a third IP address, or acquire a preconfigured static IP address, as a third IP address; and establishing network connection with the external wired network equipment through the network switching module based on the third IP address and the MAC address of the third IP address.
As an implementation manner of the embodiment of the present invention, the target system may be further configured to acquire a network connection instruction, and control the target system and the other operating systems to perform network connection based on a network connection manner indicated by the network connection instruction.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiment of the electronic device, since it is substantially similar to the embodiment of the method, the description is simple, and for the relevant points, reference may be made to part of the description of the embodiment of the method.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (12)

1. A method for establishing network connection is applied to electronic equipment, wherein the electronic equipment comprises a plurality of operating systems, each operating system is provided with a wired network card, a target system in the operating systems is also provided with a wireless network card and a network bridge, the network bridge corresponds to a virtual network card, the wired network card of the target system is respectively connected with the wired network cards of other operating systems except the target operating system in the operating systems through a network switching module, a first port of the network bridge is connected with the wireless network card, a second port of the network bridge is connected with the wired network card of the target system, and a third port of the network bridge is connected with the virtual network card, and the method comprises the following steps:
after the electronic equipment is started, the target system establishes network connection with external wireless network equipment through the virtual network card, the network bridge and the wireless network card so as to perform data transmission with the external wireless network equipment;
one or more operating systems in the other operating systems respectively establish network connection with external wireless network equipment through a wired network card of the operating system, the network switching module, a target wired network card, the network bridge and the wireless network card so as to perform data transmission with the external wireless network equipment, wherein the target wired network card is the wired network card configured in the target system.
2. The method of claim 1, wherein the establishing a network connection with an external wireless network device through its own wired network card, the network switching module, the target wired network card, the network bridge, and the wireless network card comprises:
acquiring an IP address dynamically allocated by a Dynamic Host Configuration Protocol (DHCP) server in an external wireless network as a first IP address; or, acquiring a pre-configured static IP address as a first IP address;
and establishing network connection with the external wireless network equipment through the wired network card, the network switching module, the target wired network card, the network bridge and the wireless network card based on the first IP address and the MAC address of the network bridge.
3. The method of claim 2, wherein after the establishing a network connection with the external wireless network device through its own wired network card, the network switching module, the target wired network card, the network bridge, and the wireless network card based on the first IP address and its own MAC address, the method further comprises:
a first operating system sends an access message to the network bridge through a wired network card of the first operating system, the network switching module and the target wired network card, wherein the first operating system is one of the other operating systems, and the access message carries a first IP address and an MAC address of the first operating system;
and the network bridge modifies the MAC address carried by the access message into the MAC address of the wireless network card, records the corresponding relation between the first IP address of the first operating system and the MAC address carried by the access message, and sends the modified access message to the external wireless network equipment through the wireless network card.
4. The method of claim 2, wherein after the establishing a network connection with the external wireless network device through its own wired network card, the network switching module, the target wired network card, the network bridge, and the wireless network card based on the first IP address and its own MAC address, the method further comprises:
the network bridge receives a response message sent by the external wireless network equipment through the wireless network card, wherein the response message carries a second IP address and the MAC address of the wireless network card;
the network bridge determines a target MAC address corresponding to a second IP address carried by the response message based on the recorded corresponding relation between the IP address and the MAC address carried by the access message, and modifies the MAC address carried by the response message into the target MAC address;
and the network bridge sends the modified response message to a wired network card of a second operating system corresponding to the target MAC address through the target wired network card and the network switching module, wherein the second operating system is one of the other operating systems.
5. The method of any of claims 1-4, wherein the network switching module establishes a network connection with an external wired network device; the method further comprises the following steps:
and one or more operating systems in the other operating systems are respectively connected with the external wired network equipment through the network switching module to transmit data with the external wired network equipment.
6. The method of claim 5, wherein said establishing a network connection with the outside world wired network device through the network switching module comprises:
acquiring an IP address dynamically allocated by a DHCP server in an external wired network as a third IP address; or, acquiring a pre-configured static IP address as a third IP address;
and establishing network connection with the external wired network equipment through the network switching module based on the third IP address and the MAC address of the third IP address.
7. An electronic device, wherein the electronic device includes a plurality of operating systems, each operating system is configured with a wired network card, a target system of the operating systems is further configured with a wireless network card and a network bridge, the network bridge corresponds to a virtual network card, the wired network card of the target system is respectively connected with wired network cables of other operating systems of the operating systems except the target operating system through a network switching module, a first port of the network bridge is connected with the wireless network card, a second port of the network bridge is connected with the wired network card of the target system, and a third port of the network bridge is connected with the virtual network card, wherein:
the target system is used for establishing network connection with external wireless network equipment through the virtual network card, the network bridge and the wireless network card after the electronic equipment is started so as to perform data transmission with the external wireless network equipment;
and one or more operating systems in the other operating systems are respectively used for establishing network connection with external wireless network equipment through the wired network card, the network switching module, the target wired network card, the network bridge and the wireless network card of the operating system so as to perform data transmission with the external wireless network equipment, wherein the target wired network card is the wired network card configured in the target system.
8. The electronic device of claim 7,
one or more operating systems of the other operating systems are specifically used for acquiring an IP address dynamically allocated by a DHCP server in an external wireless network as a first IP address, or acquiring a pre-configured static IP address as the first IP address; and establishing network connection with the external wireless network equipment through the wired network card, the network switching module, the target wired network card, the network bridge and the wireless network card based on the first IP address and the MAC address of the network bridge.
9. The electronic device of claim 8,
the first operating system is further configured to send an access message to the network bridge through a wired network card of the first operating system, the network switching module, and the target wired network card, where the first operating system is one of the other operating systems, and the access message carries a first IP address and an MAC address of the first operating system;
the network bridge is further configured to modify the MAC address carried in the access packet into the MAC address of the wireless network card, record a corresponding relationship between the first IP address of the first operating system and the MAC address carried in the access packet, and send the modified access packet to the external wireless network device through the wireless network card.
10. The electronic device of claim 9,
the network bridge is also used for receiving a response message sent by the external wireless network equipment through the wireless network card; determining a target MAC address corresponding to a second IP address carried by the response message based on the recorded corresponding relation between the IP address and the MAC address carried by the access message, and modifying the MAC address carried by the response message into the target MAC address; and sending the modified response message to the wired network card of the second operating system corresponding to the target MAC address through the target wired network card and the network switching module, wherein the response message carries the second IP address and the MAC address of the wireless network card, and the second operating system is one of the other operating systems.
11. The electronic device of any of claims 7-10, wherein the network switching module establishes a network connection with an external wired network device;
and one or more operating systems in the other operating systems are also respectively used for establishing network connection with the external wired network equipment through the network switching module so as to transmit data with the external wired network equipment.
12. The electronic device of claim 11,
one or more operating systems of the other operating systems are specifically configured to acquire an IP address dynamically allocated by a DHCP server in an external wired network as a third IP address, or acquire a preconfigured static IP address as the third IP address; and establishing network connection with the external wired network equipment through the network switching module based on the third IP address and the MAC address of the third IP address.
CN202011216409.9A 2020-11-04 2020-11-04 Network connection establishing method and electronic equipment Active CN112333733B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011216409.9A CN112333733B (en) 2020-11-04 2020-11-04 Network connection establishing method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011216409.9A CN112333733B (en) 2020-11-04 2020-11-04 Network connection establishing method and electronic equipment

Publications (2)

Publication Number Publication Date
CN112333733A CN112333733A (en) 2021-02-05
CN112333733B true CN112333733B (en) 2022-04-05

Family

ID=74324703

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011216409.9A Active CN112333733B (en) 2020-11-04 2020-11-04 Network connection establishing method and electronic equipment

Country Status (1)

Country Link
CN (1) CN112333733B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115150447A (en) * 2021-03-30 2022-10-04 Oppo广东移动通信有限公司 Network connection method and device, terminal device and storage medium
CN114340046B (en) * 2021-11-19 2024-03-29 南京瀚元科技有限公司 Multi-network card equipment networking communication method based on Android system
CN115412428B (en) * 2022-08-04 2023-09-12 广州通则康威智能科技有限公司 Hot backup method and device between mobile cellular network and wired network

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105978781A (en) * 2016-06-28 2016-09-28 浪潮电子信息产业股份有限公司 Method and system for establishing network connection of Docker container, and client side
CN106506314A (en) * 2016-09-30 2017-03-15 北京赢点科技有限公司 Network high availability method and device based on docker
CN110312266A (en) * 2018-03-20 2019-10-08 成都鼎桥通信技术有限公司 The method and apparatus that the multisystem of terminal realizes WIFI communication
WO2019192199A1 (en) * 2018-04-04 2019-10-10 广州视源电子科技股份有限公司 Interactive smart tablet, network domain conflict control method and device, and medium
CN111641733A (en) * 2020-06-07 2020-09-08 深圳市乙辰科技股份有限公司 Network bridge equipment management method and device and readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100477851C (en) * 2005-01-05 2009-04-08 国际商业机器公司 Method and system for carrying out switching between two communication modes of WLAN

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105978781A (en) * 2016-06-28 2016-09-28 浪潮电子信息产业股份有限公司 Method and system for establishing network connection of Docker container, and client side
CN106506314A (en) * 2016-09-30 2017-03-15 北京赢点科技有限公司 Network high availability method and device based on docker
CN110312266A (en) * 2018-03-20 2019-10-08 成都鼎桥通信技术有限公司 The method and apparatus that the multisystem of terminal realizes WIFI communication
WO2019192199A1 (en) * 2018-04-04 2019-10-10 广州视源电子科技股份有限公司 Interactive smart tablet, network domain conflict control method and device, and medium
CN111641733A (en) * 2020-06-07 2020-09-08 深圳市乙辰科技股份有限公司 Network bridge equipment management method and device and readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Windows XP的网桥功能;赵宏伟等;《沈阳大学学报》;20031230(第04期);全文 *

Also Published As

Publication number Publication date
CN112333733A (en) 2021-02-05

Similar Documents

Publication Publication Date Title
CN112333733B (en) Network connection establishing method and electronic equipment
CN111865621B (en) Method and device for accessing gateway
WO2015135425A1 (en) Message processing method, access controller and network node
EP2993838A1 (en) Method for setting identity of gateway device and management gateway device
EP2075959A1 (en) Apparatus amd method for concurently accessing multiple wireless networks (WLAN/WPAN)
JP6766393B2 (en) Communication controllers, methods and programs for DHCP
CN110224917B (en) Data transmission method, device and system and server
WO2019047611A1 (en) Data transmission method, pnf sdn controller, vnf sdn controller, and system
CN102098278B (en) Subscriber access method and system as well as access server and device
CN114615109A (en) Container network creating method and device, electronic equipment and storage medium
CN104734930B (en) Method and device for realizing access of Virtual Local Area Network (VLAN) to Variable Frequency (VF) network and Fiber Channel Frequency (FCF)
US11005706B2 (en) Method for configuring forwarding table for user equipment, apparatus, and system
CN108900441B (en) Network switching method, first electronic device and readable storage medium
CN112583655B (en) Data transmission method and device, electronic equipment and readable storage medium
CN112532506B (en) Hybrid networking method, device, server and computer-readable storage medium
CN109039680B (en) Method and system for switching main Broadband Network Gateway (BNG) and standby BNG and BNG
CN111866100A (en) Method, device and system for controlling data transmission rate
JP3154679U (en) Relay device and network system
KR20020090961A (en) An intelligent network access device and a network access method
US20230344761A1 (en) Packet communication apparatus, packet processing rule setting method and program
US11374793B2 (en) Network segment allocation system and method
CN115190168B (en) Edge server management system and server cluster
WO2023026443A1 (en) Information processing system, information processing method, and information processing program
EP4184822A1 (en) Method and apparatus for keeping user terminal alive
CN114025010B (en) Method for establishing connection and network equipment

Legal Events

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