Method and device for realizing cross-network routing in distributed soft bus
By configuring a virtual network port on the smart terminal and using iptables rules for mapping, an efficient and flexible solution for cross-network routing and data transmission is achieved, and the complex configuration and high cost in the existing technology are solved, dynamically responding to network changes, and transmission efficiency and reliability are improved.
Patent Information
- Application Number
- CN202411404696.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-10-10
AI Technical Summary
The existing technology has problems such as complex configuration, high cost and difficulty in coping with dynamic network environments in realizing cross-network routing, and cannot meet the needs of cross-network communication in modern distributed systems.
By configuring the LAN virtual network port and cross-net virtual network port on the smart terminal, and using iptables rules for network segment mapping and device mapping, transparent forwarding and dynamic routing management of data packets are realized, and real-time transmission rate and congestion across network links are evaluated and optimized.
It realizes efficient and flexible cross-network routing and data transmission in distributed soft buses, simplifies network configuration, reduces costs, can dynamically respond to network topology changes, and improves the efficiency and reliability of data transmission.
Smart Images

Figure CN119583418A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of network communication, and in particular relates to a method and a device for realizing cross-network routing in a distributed soft bus. Background Art
[0002] In a traditional network environment, cross-network routing and data transmission often need to rely on dedicated routers and protocols to forward data packets. However, this approach has certain limitations and shortcomings when dealing with complex network topology changes and flexible configuration requirements. With the rapid development of the Internet of Things, smart devices and distributed systems, the demand for cross-network routing and data transmission is increasing. With the support of system communication services such as distributed soft buses, ad hoc networking and data transmission between devices have become more important. However, current technology still has some challenges in achieving cross-network routing, such as complex configuration, high cost, and difficulty in dealing with dynamic network environments. Therefore, it is necessary to propose a new technical solution to solve these challenges. The background technology of the present invention is proposed in response to these problems, and is intended to achieve cross-network routing and data transmission in a distributed soft bus in an efficient and flexible manner. Through the application of key technologies such as flexible configuration of network interfaces, flexible configuration of iptables rules, transparent forwarding of data packets and dynamic routing management, the present invention aims to provide a simple and efficient solution to meet the needs of cross-network communication in modern distributed systems. Summary of the invention
[0003] In view of this, the present invention provides a method for implementing cross-network routing in a distributed soft bus, characterized in that the method comprises:
[0004] Step S1, configuring a network interface on the intelligent terminal; the network interface includes a local area network virtual network port and an inter-network virtual network port, and the local area network virtual network port and the inter-network virtual network port are connected via a bridge;
[0005] Step S2, configuring iptables rules, wherein the iptables rules connect LAN devices and extranet devices through network segment mapping and device mapping;
[0006] Step S3: According to the configured iptables rules,
[0007] Forwarding data packets from the LAN device entering through the LAN virtual network port to the first link between the inter-network virtual network port and the external network device for communication;
[0008] Forwarding data packets from the external network device entering through the inter-network virtual network port to the second link between the local area network virtual network port and the local area network for communication;
[0009] Step S4: When the network topology changes, dynamically update the iptables rules of the first link and the second link;
[0010] Step S5: Evaluate the real-time transmission rate and congestion status of the first link and the second link, and perform congestion management on the data packets entering and leaving the local area network virtual network port and the inter-network virtual network port based on the priority.
[0011] In particular, in step S5, evaluating the real-time sending rate across the network link specifically includes:
[0012] In the first link and the second link, data sub-flows of different applications are included;
[0013] The real-time sending rate in the link at time point r is calculated according to the following formula:
[0014]
[0015] Among them, S a (r) represents the real-time transmission rate of link a at time point r, τ a represents the basic transmission rate of link a, k∈K, K represents the set of all data transmission sub-flows on link a, k represents the kth data transmission sub-flow on link a, w k represents the weighting factor of data transmission sub-stream k, E k (r a\r ) represents the actual sending rate of subflow k on link a at other time points except time point r.
[0016] In particular, in step S5, evaluating the congestion situation of cross-network links specifically includes:
[0017] Congestion risk index of link a at time point r The calculation method is:
[0018]
[0019] Where r'∈R a \r, r' represents a time point related to link a, R a represents the set of all time points related to link a, R a \r means in the set R a Remove time point r from the Represents an indicator function, which is used to count the number of elements that meet a certain condition. Its value is only 0 or 1. If the condition in the brackets is met, the value of the indicator function is 1, otherwise it is 0; u a r represents the lower limit of bandwidth utilization of link a at time point r; It represents the bandwidth utilization upper limit of link a at time point r'.
[0020] In particular, in step S5, performing congestion management on data packets entering and leaving the network based on priority specifically includes: classifying different application flows into different priorities according to service types;
[0021] When the calculated congestion risk index of link a exceeds the preset threshold, the weighting factor w of data transmission subflow k is adjusted. k , reduce the sending rate of low-priority application flows and increase the sending priority of high-priority application flows.
[0022] In particular, the method further comprises:
[0023] When the LAN interface is enabled, the network segment mapping rules are configured according to the LAN segment and subnet mask;
[0024] When monitoring the LAN device online, configure the device mapping rules according to the LAN device IP address and port, external network IP address and port;
[0025] When the LAN interface is found to be disabled, the corresponding network segment mapping rule is deleted;
[0026] When the LAN device is detected to be offline, the corresponding device mapping rule is deleted.
[0027] The present invention also discloses a device for implementing cross-network routing in a distributed soft bus, comprising:
[0028] A network interface configuration module, used to configure a network interface on the intelligent terminal; the network interface includes a local area network virtual network port and an inter-network virtual network port, and the local area network virtual network port and the inter-network virtual network port are connected via a bridge;
[0029] An iptables rule configuration module is used to configure iptables rules, wherein the iptables rules connect LAN devices and extranet devices through network segment mapping and device mapping;
[0030] Data forwarding module, used to forward data according to the configured iptables rules.
[0031] Forwarding data packets from the LAN device entering through the LAN virtual network port to the first link between the inter-network virtual network port and the external network device for communication;
[0032] Forwarding data packets from the external network device entering through the inter-network virtual network port to the second link between the local area network virtual network port and the local area network for communication;
[0033] A dynamic routing management module, used to dynamically update the iptables rules of the first link and the second link when the network topology changes;
[0034] The rate and congestion management module is used to evaluate the real-time transmission rate and congestion of the first link and the second link, and perform congestion management on the data packets entering and leaving the local area network virtual network port and the inter-network virtual network port based on the priority.
[0035] Beneficial effects:
[0036] Through the technical solution of the present invention, a method and device for implementing cross-network routing in a distributed soft bus are realized, which has the following technical effects:
[0037] It is possible to flexibly configure network interfaces on smart terminals, including LAN virtual network ports and cross-network virtual network ports, and connect them through bridges to achieve network connectivity between devices.
[0038] It provides flexible iptables rule configuration to implement network segment mapping and device mapping, so that LAN devices and external network devices can access each other, providing basic support for data transmission.
[0039] According to the configured iptables rules, data packets entering and leaving the network are transparently forwarded, realizing the cross-network routing function, so that data can be seamlessly transmitted between different networks.
[0040] It can dynamically update iptables rules according to changes in network topology, realize dynamic routing management, and ensure the real-time and stability of network communications.
[0041] Evaluate the real-time sending rate and congestion situation across network links, manage congestion of data packets entering and leaving the network by giving priority, and improve the efficiency and reliability of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 The present invention provides a method for implementing cross-network routing in a distributed soft bus;
[0043] Figure 2 This is a schematic diagram of the cross-network routing device implemented in the distributed soft bus proposed by the present invention. DETAILED DESCRIPTION
[0044] The present invention is described in detail below with reference to the accompanying drawings and embodiments.
[0045] The present invention provides a method for implementing cross-network routing in a distributed soft bus, such as Figure 1 As shown, including:
[0046] A network interface is configured on the smart terminal, wherein the network interface includes a local area network virtual network port and an inter-network virtual network port, and the local area network virtual network port and the inter-network virtual network port are connected via a bridge; 1. Network configuration: different network interfaces and IP addresses are configured according to the actual network environment and requirements to ensure connectivity between different networks.
[0047] Perform the following configuration on the smart terminal: create a LAN virtual network port and a cross-network virtual network port, and connect them through a bridge.
[0048] 1) Configure the LAN virtual network port. Create a virtual network port for the smart terminal to make it part of the LAN. Assign a local IP address to the virtual network port so that it can communicate with other devices in the same LAN. This configuration ensures that the device can communicate directly with other devices in the LAN.
[0049] 2) Configure a cross-network virtual WAN port. Create a virtual network port for the smart terminal so that it can communicate across different networks. Assign an IP address to the virtual network port, which is the entry address of the entire subnet. In this way, the device can communicate with devices on other subnets.
[0050] 3) Connect the LAN virtual network port and the inter-network virtual network port through a bridge. A bridge is a network device that can connect multiple network interfaces together so that they appear as one network logically. Add the LAN virtual network port and the inter-network virtual network port to the bridge to ensure that they can communicate with each other.
[0051] Through the above configuration, the device can transmit data between the LAN and other networks. The LAN virtual network port allows the device to communicate directly with other devices in the LAN, while the road network virtual network port allows the device to communicate with devices on other networks. Through the connection of the bridge, these two virtual network ports can realize seamless forwarding and transmission of data.
[0052] Configure iptables rules to implement network segment mapping and device mapping, so that LAN devices can actively access external network addresses, and external network devices can also access LAN devices; 2. Iptables rule configuration: By configuring iptables rules, data packets entering and leaving the network are forwarded and processed. The various matching conditions and actions provided by it can be used to implement flexible data packet filtering and forwarding strategies.
[0053] Use iptables mechanism to manage the mapping table. For network segment mapping:
[0054] iptables-t nat-APOSTROUTING-s 172.17.0.0 / 16-j MASQUERADE
[0055] The 172.17.0.0 / 16 part is the LAN segment IP and mask that needs to be configured. After the configuration is completed, when the LAN device actively accesses the external network address, the proxy node will automatically establish a random port mapping for the LAN device.
[0056] For device mapping:
[0057] iptables -t nat -A PREROUTING -d 10.152.227.173 -p tcp --dport 10088-jDNAT --to 172.17.0.2:8888
[0058] 10.152.227.173, 10088, 172.17.0.2: 8888 is the internal network ip+port that needs to be mapped and the external network ip+port after mapping. The external network ip address can be obtained by looking up the proxy interface address, and the external network port number can be configured by looking up an unused port. After the configuration is completed, when the external network device accesses the LAN device, it can access it through the external network ip+port to achieve the effect of network traversal.
[0059] According to the configured iptables rules, the data packets entering and leaving the network are transparently forwarded to achieve cross-network routing; when the data packet reaches the intelligent terminal node, it is forwarded to the target network according to the rule configuration and action definition. In this way, the data packet can be transparently transmitted between different networks, realizing the function of cross-network routing;
[0060] When the LAN finds that the corresponding interface is up, this module automatically maps the network segment. After the configuration is completed, when the LAN device actively accesses the external network address, the proxy node will automatically establish a random port mapping for the LAN device.
[0061] When the LAN device is online, this module performs single device listening port mapping. After the configuration is completed, when the external network device accesses the LAN device, it can access it through the external network ip+port, achieving the effect of network traversal.
[0062] When data is transmitted across networks, the data from the sender (smart device 1) passes through the Hongmeng device (cross-network routing), and the source address is automatically switched to the external network IP. When the data reaches the other end Hongmeng device, the destination address is switched to the internal network IP and finally reaches smart device 6.
[0063] According to the changes in network topology, the iptables rules are dynamically updated to achieve dynamic routing management;
[0064] According to the network topology and dynamic changes, dynamic routing management can be achieved by updating and modifying iptables rules. In this way, the network can flexibly adjust and optimize routing according to real-time needs.
[0065] 1) When the LAN finds that the corresponding interface is up, the cross-network routing management module automatically maps the network segment.
[0066] 2) When the LAN device is online, the cross-network routing management module interface performs single-device listening port mapping and stores records;
[0067] 3) When the LAN finds that the corresponding interface is down, the cross-network routing management module deletes the automatic mapping of the network segment;
[0068] 4) When the LAN device goes offline, the cross-network routing management interface deletes the single device listening port mapping and deletes the record;
[0069] Evaluate real-time sending rates and congestion across network links, and perform congestion management on packets entering and leaving the network based on priority.
[0070] Evaluating the real-time sending rate across network links specifically includes:
[0071] In the first link and the second link, data sub-flows of different applications are included;
[0072] The real-time sending rate in the link at time point r is calculated according to the following formula:
[0073]
[0074] Among them, S a (r) represents the real-time transmission rate of the link a at time point r, τ a represents the basic transmission rate of link a, k∈K, K represents the set of all data transmission sub-flows on link a, k represents the kth data transmission sub-flow on link a, w k represents the weighting factor of data transmission sub-stream k, E k (r a\r ) represents the actual sending rate of subflow k on link a at other time points except time point r.
[0075] In particular, in step S5, evaluating the congestion situation of cross-network links specifically includes:
[0076] Congestion risk index of link a at time point r The calculation method is:
[0077]
[0078] Where r'∈Ra \r, r' represents a time point related to link a, R a represents the set of all time points related to link a, R a \r means in the set R a Remove time point r from the Represents an indicator function, which is used to count the number of elements that meet a certain condition. Its value is only 0 or 1. If the condition in the brackets is met, the value of the indicator function is 1, otherwise it is 0; u a r represents the lower limit of bandwidth utilization of link a at time point r; It represents the bandwidth utilization upper limit of link a at time point r'.
[0079] In step S5, evaluating the congestion situation of the cross-network links specifically includes:
[0080] Congestion risk index of link a at time point r The calculation method is:
[0081]
[0082] Where r'∈R a \r, r' represents a time point related to link a, R a represents the set of all time points related to link a, R a \r means in the set R a Remove time point r from the Represents an indicator function, which is used to count the number of elements that meet a certain condition. Its value is only 0 or 1. If the condition in the brackets is met, the value of the indicator function is 1, otherwise it is 0; u a r represents the lower limit of bandwidth utilization of link a at time point r; It represents the bandwidth utilization upper limit of link a at time point r'.
[0083] In step S5, performing congestion management on data packets entering and leaving the network based on priority specifically includes: classifying different application flows into different priorities according to service types;
[0084] When the calculated congestion risk index of link a exceeds the preset threshold, the weighting factor w of data transmission subflow k is adjusted. k , reduce the sending rate of low-priority application flows and increase the sending priority of high-priority application flows.
[0085] The present invention also discloses a device for implementing cross-network routing in a distributed soft bus, such as Figure 2 As shown, including:
[0086] A network interface configuration module, used to configure a network interface on the intelligent terminal; the network interface includes a local area network virtual network port and an inter-network virtual network port, and the local area network virtual network port and the inter-network virtual network port are connected via a bridge;
[0087] An iptables rule configuration module is used to configure iptables rules, wherein the iptables rules connect LAN devices and extranet devices through network segment mapping and device mapping;
[0088] Data forwarding module, used to forward data according to the configured iptables rules.
[0089] Forwarding data packets from the LAN device entering through the LAN virtual network port to the first link between the inter-network virtual network port and the external network device for communication;
[0090] Forwarding data packets from the external network device entering through the inter-network virtual network port to the second link between the local area network virtual network port and the local area network for communication;
[0091] A dynamic routing management module, used to dynamically update the iptables rules of the first link and the second link when the network topology changes;
[0092] The rate and congestion management module is used to evaluate the real-time transmission rate and congestion of the first link and the second link, and perform congestion management on the data packets entering and leaving the local area network virtual network port and the inter-network virtual network port based on the priority.
[0093] The solution for which the device seeks protection corresponds one-to-one to the solution in the previous method embodiment, so it will not be described in detail.
[0094] In summary, the above are only preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
[0095] It is obvious to those skilled in the art that the embodiments of the present invention are not limited to the details of the above exemplary embodiments, and that the embodiments of the present invention can be implemented in other specific forms without departing from the spirit or basic features of the embodiments of the present invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the embodiments of the present invention is limited by the attached claims rather than the above description, so it is intended to include all changes that fall within the meaning and scope of the equivalent elements of the claims in the embodiments of the present invention. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units, modules or devices stated in the system, device or terminal claims can also be implemented by the same unit, module or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0096] Finally, it should be noted that the above implementation modes are only used to illustrate the technical solutions of the embodiments of the present invention and are not intended to limit them. Although the embodiments of the present invention have been described in detail with reference to the above preferred implementation modes, those skilled in the art should understand that the technical solutions of the embodiments of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for implementing cross-network routing in a distributed soft bus, characterized in that: The method comprises: Step S1, configuring a network interface on the intelligent terminal; the network interface includes a local area network virtual network port and an inter-network virtual network port, and the local area network virtual network port and the inter-network virtual network port are connected via a bridge; Step S2: configure iptables rules, wherein the iptables rules connect LAN devices and extranet devices through network segment mapping and device mapping; Step S3: According to the configured iptables rules, Forwarding data packets from the LAN device entering through the LAN virtual network port to the first link between the inter-network virtual network port and the external network device for communication; Forwarding data packets from the external network device entering through the inter-network virtual network port to the second link between the local area network virtual network port and the local area network for communication; Step S4: When the network topology changes, dynamically update the iptables rules of the first link and the second link; Step S5: Evaluate the real-time transmission rate and congestion status of the first link and the second link, and perform congestion management on the data packets entering and leaving the local area network virtual network port and the inter-network virtual network port based on the priority.
2. The method according to claim 1, characterized in that In step S5, evaluating the real-time transmission rate across the network link specifically includes: In the first link and the second link, data sub-flows of different applications are included; The real-time sending rate in the link at time point r is calculated according to the following formula: Among them, S a (r) represents the real-time transmission rate of the link a at time point r, τ a represents the basic transmission rate of link a, k∈K, K represents the set of all data transmission sub-flows on link a, k represents the kth data transmission sub-flow on link a, w k represents the weighting factor of data transmission sub-stream k, E k (r a\r ) represents the actual sending rate of subflow k on link a at other time points except time point r.
3. The method according to claim 2, characterized in that In step S5, evaluating the congestion situation of the cross-network links specifically includes: Congestion risk index of link a at time point r The calculation method is: Where r'∈R a \r, r' represents a time point related to link a, R a represents the set of all time points related to link a, R a \r means in the set R a Remove time point r from the Represents an indicator function, which is used to count the number of elements that meet a certain condition. Its value is only 0 or 1. If the condition in the brackets is met, the value of the indicator function is 1, otherwise it is 0; u a r represents the lower limit of bandwidth utilization of link a at time point r; It represents the bandwidth utilization upper limit of link a at time point r'.
4. The method according to claim 2 or 3, characterized in that: In step S5, performing congestion management on data packets entering and leaving the network based on priority specifically includes: classifying different application flows into different priorities according to service types; When the calculated congestion risk index of link a exceeds the preset threshold, the weighting factor w of data transmission subflow k is adjusted. k , reduce the sending rate of low-priority application flows and increase the sending priority of high-priority application flows.
5. The method according to claim 4, characterized in that The method further comprises: When the LAN interface is found to be enabled, the network segment mapping rules are configured according to the LAN segment and subnet mask; When monitoring the LAN device online, configure the device mapping rules according to the LAN device IP address and port, external network IP address and port; When the LAN interface is found to be disabled, the corresponding network segment mapping rule is deleted; When the LAN device is detected to be offline, the corresponding device mapping rule is deleted.
6. A device for implementing cross-network routing in a distributed soft bus, characterized in that: include: A network interface configuration module, used to configure a network interface on the intelligent terminal; the network interface includes a local area network virtual network port and an inter-network virtual network port, and the local area network virtual network port and the inter-network virtual network port are connected via a bridge; An iptables rule configuration module is used to configure iptables rules, wherein the iptables rules connect LAN devices and extranet devices through network segment mapping and device mapping; Data forwarding module, used to forward data according to the configured iptables rules. Forwarding data packets from the LAN device entering through the LAN virtual network port to the first link between the inter-network virtual network port and the external network device for communication; Forwarding data packets from the external network device entering through the inter-network virtual network port to the second link between the local area network virtual network port and the local area network for communication; A dynamic routing management module, used to dynamically update the iptables rules of the first link and the second link when the network topology changes; The rate and congestion management module is used to evaluate the real-time transmission rate and congestion of the first link and the second link, and perform congestion management on the data packets entering and leaving the local area network virtual network port and the inter-network virtual network port based on the priority.
Citation Information
Patent Citations
MEC-based wireless network transmission optimization method and system
CN111866947A
Port real-time data stream visualization method and system based on finite-state machine
CN115396323A
Network construction method and device, electronic equipment and storage medium
CN117176694A
Scalable Port Controller Architecture Supporting Data Streams Of Different Speeds
US20090157916A1