A message forwarding method and device
By configuring a dynamic mapping table in the dial-up device, the address translation is performed by selecting unassigned available addresses from the address prefix range allocated by the external network server. This solves the problem of address translation failure when the internal and external network configurations are different, reduces the difficulty of network configuration, and improves forwarding efficiency.
Patent Information
- Application Number
- CN202511366370.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-23
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2045-09-23
AI Technical Summary
In dial-up scenarios, when the internal and external network configurations are different, the internal address prefix length is shorter than the external address prefix length, causing address translation failure. Furthermore, requiring the internal and external network configurations to be the same increases the configuration difficulty. Additionally, some addresses within the external address prefix range cannot be used for address translation, leading to translation failure.
Configure a dynamic mapping table in the dial-up device to store the mapping relationship between internal network addresses and external network addresses. After receiving data packets, select an unassigned available address from the address prefix range allocated by the external network server as the external network address, and record the mapping relationship in the dynamic mapping table to complete the address conversion.
It reduces the difficulty of network configuration, ensures the uniqueness of each external network address, avoids duplication or unavailability after address translation, solves the problem of address translation failure, and improves packet forwarding efficiency.
Smart Images

Figure CN121239665B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a message forwarding method and apparatus. Background Technology
[0002] In a proxy dialing scenario, internal network user equipment sends data packets to external network servers through a proxy dialing device. The proxy dialing device converts the address prefix of the source address included in the data packet into an external network address prefix, and then sends the data packet with the replaced prefix to the external network server, thereby realizing address translation and proxying the internal network user equipment to send data packets to the external network.
[0003] In the above-mentioned packet forwarding scheme of the dialing device, when the network configurations of the internal network and the external network are different, there will be a situation where the length of the internal network address prefix is less than the length of the external network address prefix. When the length of the internal network address prefix is less than the length of the external network address prefix, the number of addresses required by the internal network user devices is greater than the number of addresses that the external network can provide. This leads to some internal network user devices getting the same address after the address prefix is replaced, resulting in address translation failure.
[0004] Furthermore, the above-mentioned scheme for forwarding messages by proxy devices may also require the internal and external network configurations to be the same, which increases the difficulty of network configuration. In addition, one or more addresses in the external address prefix range may not be able to be used for address translation between internal and external networks. However, when address translation is implemented by address prefix replacement, unusable addresses cannot be eliminated, which leads to the problem of address translation failure. Summary of the Invention
[0005] The purpose of this application is to provide a message forwarding method and apparatus to reduce network configuration difficulty and solve the problem of address translation failure of intranet user equipment. The specific technical solution is as follows:
[0006] In a first aspect, embodiments of this application provide a message forwarding method applied to a dial-up device in an intranet, wherein the dial-up device is configured with a dynamic mapping table, and the dynamic mapping table stores the mapping relationship between intranet addresses and extranet addresses; the method includes:
[0007] Receive a first data packet sent by a user equipment in the intranet, wherein the source address of the first data packet is a first intranet address and the destination address of the first data packet is the address of an external network server;
[0008] Find the first external network address corresponding to the first internal network address in the dynamic mapping table;
[0009] If the first external network address is not found, then an unassigned available address is selected from the address prefix range allocated by the external network server as the first external network address.
[0010] The target mapping relationship between the first intranet address and the first extranet address is recorded in the dynamic mapping table, and the first intranet address included in the first data packet is converted into the first extranet address to obtain the second data packet;
[0011] The second data packet is sent to the external network server.
[0012] In some embodiments, the method further includes:
[0013] If the first external network address is found, the first internal network address included in the first data packet is converted to the first external network address to obtain the second data packet;
[0014] The second data packet is sent to the external network server.
[0015] In some embodiments, within the address prefix range allocated by the external network server, unallocated available addresses are recorded in the doubly linked list corresponding to the external network server;
[0016] The step of selecting an unassigned available address from the address prefix range allocated by the external network server as the first external network address includes:
[0017] The usable address at the head of the doubly linked list is removed and used as the first external network address.
[0018] In some embodiments, the method further includes:
[0019] After recording the target mapping relationship in the dynamic mapping table, the target mapping relationship is set to an active state;
[0020] Detect the status of the target mapping relationship in the dynamic mapping table;
[0021] When the target mapping relationship is detected to be inactive, the target mapping relationship is deleted.
[0022] In some embodiments, the dynamic mapping table also records the number of packets that use the mapping relationship for address translation;
[0023] The step of detecting the status of the target mapping relationship between the first internal network address and the first external network address in the dynamic mapping table includes:
[0024] At preset intervals, the number of target packets that have undergone address translation using the target mapping relationship is read, and the number of target packets is cleared.
[0025] When the number of target messages read consecutively is less than a preset number, the target mapping relationship is determined to be in an inactive state.
[0026] In some embodiments, within the address prefix range allocated by the external network server, unallocated available addresses are recorded in the doubly linked list corresponding to the external network server;
[0027] After deleting the target mapping relationship, the method further includes:
[0028] Add the first external network address to the tail of the doubly linked list.
[0029] Secondly, embodiments of this application provide a message forwarding device applied to a dial-up device in an intranet, wherein the dial-up device is configured with a dynamic mapping table, and the dynamic mapping table stores the mapping relationship between intranet addresses and extranet addresses; the device includes:
[0030] The receiving module is used to receive a first data packet sent by a user equipment in the intranet, wherein the source address of the first data packet is a first intranet address and the destination address of the first data packet is the address of an external network server.
[0031] The lookup module is used to look up the first external network address corresponding to the first internal network address in the dynamic mapping table;
[0032] The allocation module is used to select an unallocated available address from the address prefix range allocated by the external network server as the first external network address if the first external network address is not found.
[0033] The conversion module is used to record the target mapping relationship between the first intranet address and the first extranet address in the dynamic mapping table, and convert the first intranet address included in the first data packet into the first extranet address to obtain the second data packet;
[0034] The sending module is used to send the second data packet to the external network server.
[0035] In some embodiments, the conversion module is further configured to, if the first external network address is found, convert the first internal network address included in the first data packet to the first external network address to obtain a second data packet.
[0036] In some embodiments, within the address prefix range allocated by the external network server, unallocated available addresses are recorded in the doubly linked list corresponding to the external network server;
[0037] The allocation module is specifically used to remove the available address from the head of the doubly linked list and use it as the first external network address.
[0038] In some embodiments, the allocation module is further configured to: after recording the target mapping relationship in the dynamic mapping table, set the target mapping relationship to an active state; detect the state of the target mapping relationship in the dynamic mapping table; and delete the target mapping relationship when the target mapping relationship is detected to be in an inactive state.
[0039] In some embodiments, the dynamic mapping table also records the number of packets that use the mapping relationship for address translation;
[0040] The allocation module is specifically used to read the number of target packets that use the target mapping relationship for address translation at preset intervals, and clear the number of target packets; when the number of target packets read is less than the preset number for a preset number of consecutive times, it is determined that the target mapping relationship is in an inactive state.
[0041] In some embodiments, within the address prefix range allocated by the external network server, unallocated available addresses are recorded in the doubly linked list corresponding to the external network server;
[0042] The allocation module is further configured to add the first external network address to the tail of the doubly linked list after deleting the target mapping relationship.
[0043] Beneficial effects of the embodiments in this application:
[0044] In the technical solution provided in this application, after receiving a data packet sent by a user equipment in the intranet to an external server, the dial-up device replaces the complete source address included in the data packet with a complete externally available address from the address prefix range allocated by the external server, instead of simply performing address prefix translation. In this case, it is not required that the number of complete available addresses in the address prefix range allocated by the external server be proportional to the number of addresses needed by the intranet user equipment, thus reducing the difficulty of network configuration.
[0045] Furthermore, the technical solution provided in this application uses complete external network available addresses for address translation. Each external network available address is unique and usable, so that the addresses obtained by different internal network user devices after address translation will not be the same or unusable, thereby solving the problem of address translation failure of internal network user devices.
[0046] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description
[0047] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0048] Figure 1 A schematic diagram of a dial-up network setup;
[0049] Figure 2 This is a schematic diagram of a first type of message forwarding method provided in an embodiment of this application;
[0050] Figure 3 This is a second flowchart illustrating the message forwarding method provided in the embodiments of this application;
[0051] Figure 4 A schematic diagram of a message forwarding signaling interaction process provided in an embodiment of this application;
[0052] Figure 5 A schematic diagram of a doubly linked list provided in an embodiment of this application;
[0053] Figure 6 A schematic diagram of a message forwarding device provided in an embodiment of this application;
[0054] Figure 7 This is a schematic diagram of a dispatching device provided in an embodiment of this application. Detailed Implementation
[0055] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.
[0056] For ease of understanding, the terms appearing in the embodiments of this application are explained below.
[0057] Network Address Translation for IPv6 to IPv6 (NAT66) is an address translation technology used in IPv6 networks.
[0058] In an IPv6 network, each network device is assigned a globally unique IPv6 address, which is 128 bits long. NAT66 performs address translation by mapping the internal device's IPv6 address to another set of IPv6 addresses, allowing internal devices to access external networks while protecting the internal device's real IPv6 address from direct external exposure.
[0059] Point-to-Point Protocol over Ethernet (PPPoE) proxy dialing: A technology in which a proxy device (usually a router or server) replaces all user devices connected to it, performs PPPoE dialing authentication uniformly, and shares the same broadband account.
[0060] like Figure 1 The dial-up network shown is configured such that Broadband Remote Access Server (BRAS) 1 is the dial-up device within the intranet. The intranet also includes an Authentication, Authorization and Accounting (AAA) server, a portal server, a service server, and user equipment (such as…). Figure 1 Devices 1 through 4 in the internal network can connect to BRAS1 through one or more tiers of switching equipment, or they can connect directly to BRAS1. The external network is divided into networks from different operators, such as... Figure 1 The network of operator 1, the network of operator 2, and the network of operator 3 are respectively connected to BRAS1 through BRAS2 to BRAS4 in the networks of operator 1 to operator 3.
[0061] When a user device in the intranet accesses the extranet, such as when device 1 accesses a service server in operator 1's network, device 1 sends message 1 to BRAS1. The source address of message 1 is device 1's address, i.e., its intranet address, such as 1:1:1:1, with an intranet address prefix of 1:1:1:0 / 96. The destination address of message 1 is the service server in operator 1's network, i.e., its extranet address, such as 2:2:2:2, with an extranet address prefix of 2:2:0:0 / 64. BRAS1 directly replaces the address prefix of 1:1:1:1 with the address prefix of 2:2:2:2, obtaining address 2:2:1:1; it converts the source address of message 1 to 2:2:1:1, obtaining message 2, and sends message 2 to the service server in operator 1's network.
[0062] In this packet forwarding scheme using proxy devices, if different network configurations are allowed between the internal and external networks, there may be cases where the length of the internal network address prefix is shorter than the length of the external network address prefix. This can lead to some internal network user devices receiving the same address after address prefix replacement, resulting in address translation failure.
[0063] For example, the internal network address prefix length is 64 bits, so the internal network address prefix is 1:1:0:0 / 64. The external network address prefix length is 96 bits, so the external network address prefix is 2:2:2:0 / 96. Then, some user devices on the internal network have different values for bits 65 to 96 of their addresses, but different values for bits 97 to 128. For example, user device A's address is 1:1:1:1, and user device B's address is 1:1:2:1. If a dial-up device performs address translation on packets sent by user device A and user device B respectively, the resulting address will be 2:2:2:1, and the address translation will fail.
[0064] Furthermore, this dial-up message scheme increases the complexity of network configuration if the internal and external networks require identical network configurations. Additionally, one or more addresses within the external address prefix range may be unusable for address translation between the internal and external networks, but address prefix replacement cannot eliminate unusable addresses, leading to address translation failures.
[0065] To address the aforementioned problems, embodiments of this application provide a message forwarding method, such as... Figure 2 As shown, a dial-up device applied in an intranet is described. The device is configured with a dynamic mapping table that stores the mapping relationship between intranet addresses and extranet addresses. The method includes the following steps:
[0066] Step S201: Receive a first data packet sent by a user equipment in the intranet. The source address of the first data packet is a first intranet address, and the destination address of the first data packet is the address of an external network server.
[0067] Step S202: Find the first external network address corresponding to the first internal network address in the dynamic mapping table;
[0068] Step S203: If the first external network address is not found, select an unassigned available address from the address prefix range allocated by the external network server as the first external network address.
[0069] Step S204: Record the target mapping relationship between the first internal network address and the first external network address in the dynamic mapping table, and convert the first internal network address included in the first data packet to the first external network address to obtain the second data packet;
[0070] Step S205: Send the second data packet to the external network server.
[0071] In the technical solution provided in this application, after receiving a data packet sent by a user equipment in the intranet to an external server, the dial-up device replaces the complete source address included in the data packet with a complete externally available address from the address prefix range allocated by the external server, instead of simply performing address prefix translation. In this case, it is not required that the number of complete available addresses in the address prefix range allocated by the external server be proportional to the number of addresses needed by the intranet user equipment, thus reducing the difficulty of network configuration.
[0072] Furthermore, the technical solution provided in this application uses complete external network available addresses for address translation. Each external network available address is unique and usable, so that the addresses obtained by different internal network user devices after address translation will not be the same or unusable, thereby solving the problem of address translation failure of internal network user devices.
[0073] In this embodiment, the proxy dialing device is a network device that implements the proxy dialing function, such as a router, switch, or BRAS. The internal network address is the address used by user devices within the internal network, i.e., the address used when a user device accesses a business server or other user devices within the internal network; this is the address before translation. The external network address is the address used by user devices within the external network, i.e., the address used when a user device accesses a business server within the external network; this is the address after translation. Both the internal and external network addresses consist of an address prefix and other parts. The address prefix of the internal network address and the address prefix of the external network address can be different, and the other parts of the internal network address and the other parts of the external network address can also be different. Both the internal and external network addresses can be IPv6 addresses; there is no limitation on this. The dynamic mapping table maps internal and external network addresses one-to-one.
[0074] In step S201 above, the user equipment in the intranet is a dial-up user equipment. The first intranet address is the intranet address of the user equipment. The external network server is the service server within the operator's network.
[0075] When a user equipment (UE) accesses the external network, it sends a data packet, such as a first data packet, to a proxy dialing device. The source address of this first data packet is a first internal network address, and the destination address is the address of the external network server. The proxy dialing device receives the first data packet sent by the UE.
[0076] In step S202 above, the first external network address is the external network address that has a mapping relationship with the first internal network address in the dynamic mapping table, which can also be understood as the converted address of the first internal network address.
[0077] The dialing device extracts the first internal network address from the first data packet and searches for it in the dynamic mapping table. If the first internal network address is found, it means that the dynamic mapping table records the first external network address corresponding to the first internal network address, and finding the first external network address means that a translated address has been assigned to the user equipment. If the first internal network address is not found, it means that the dynamic mapping table does not record the first external network address corresponding to the first internal network address, and not finding the first external network address means that a translated address has not yet been assigned to the user equipment. If the first external network address is not found, the dialing device executes step S203.
[0078] In this embodiment of the application, in order to improve network security, the proxy dialing device can perform security checks such as deep packet inspection on the first data packet before looking up the first internal network address in the dynamic mapping table; after the first data packet successfully passes the security check, step S202 is executed to look up the first internal network address in the dynamic mapping table.
[0079] In step S203 above, the address prefix allocated by the external network server can be a shared address prefix allocated to all user devices in the internal network, or it can be a unique address prefix allocated to a single user device in the internal network. The range of the address prefix allocated by the external network server includes all addresses under the address prefix allocated by the external network server. For example, if the address prefix allocated by the external network server is 1:1:1:0, and its address prefix length is 120, then the range of 1:1:1:0 includes addresses from 1:1:1:0 to 1:1:1:255. Available addresses are those that can be used for address translation.
[0080] If the dialing device does not find the first external network address in the dynamic mapping table, it selects an unassigned available address from the address prefix range allocated by the external network server as the first external network address.
[0081] In this embodiment of the application, the dialing device can use any of the following methods to allocate the first external network address.
[0082] Method 1: Within the address prefix range allocated by the external network server, unassigned available addresses are recorded in the corresponding doubly linked list of the external network server. If the dialing device does not find the first external network address in the dynamic mapping table, the available address at the head of the doubly linked list is removed and used as the first external network address.
[0083] Method 2: Within the address prefix range allocated by the external network server, unassigned available addresses form an address pool.
[0084] If the proxy device does not find the first external network address in the dynamic mapping table, it randomly or in a round-robin fashion selects an available address from the address pool as the first external network address and deletes the first external network address from the address pool.
[0085] In this embodiment of the application, the proxy dialing device may also use other methods to allocate the first external network address, as long as it ensures that it obtains a complete address within the address prefix range allocated by the external network server.
[0086] In step S204 above, the target mapping relationship is the mapping relationship between the first internal network address and the first external network address.
[0087] After obtaining the first external network address, the dial-up device can perform the following two operations in parallel:
[0088] Operation 1: Record the target mapping relationship between the first internal network address and the first external network address in the dynamic mapping table.
[0089] Operation 2: Convert the first internal network address included in the first data packet to the first external network address, thereby realizing the source address conversion in the first data packet. The first data packet with the source address converted is the second data packet. The source address of the second data packet is the first external network address, and the destination address of the second data packet is the address of the external network server.
[0090] Then, the proxy device executes step S205, which sends a second data packet to the external network server according to the forwarding table or flow table, thereby realizing packet forwarding.
[0091] After receiving the second data packet, the external network server can send a third data packet to the proxy dialing device. The source address of the third data packet is the address of the external network server, and the destination address is the first external network address. Upon receiving the third data packet, the proxy dialing device looks up the first internal network address corresponding to the first external network address in a dynamic mapping table. It then converts the first external network address in the third data packet to the first internal network address, resulting in a fourth data packet. The destination address of the fourth data packet is then converted back to the first internal network address. The proxy dialing device then sends the fourth data packet to the user equipment according to a forwarding table or flow table, etc.
[0092] In some embodiments, such as Figure 3 As shown, a message forwarding method is also provided, which is applied to dial-up devices in an intranet. This method may include the following steps:
[0093] Step S301: Receive a first data packet sent by a user device in the intranet. The source address of the first data packet is the first intranet address, and the destination address of the first data packet is the address of the external network server. Step S301 is the same as step S201 above.
[0094] Step S302: Search for the first external network address corresponding to the first internal network address in the dynamic mapping table; if the first external network address is not found, proceed to step S303; if the first external network address is found, proceed to step S305; step S302 is the same as step S202 above.
[0095] Step S303: Select an unassigned available address from the address prefix range allocated by the external network server as the first external network address; then, execute steps S304 and S305 in parallel; the implementation of step S303 can be found in the relevant description of step S203 above.
[0096] Step S304: Record the target mapping relationship between the first internal network address and the first external network address in the dynamic mapping table; the implementation of step S304 can be found in the relevant description of step S203 above.
[0097] Step S305: Convert the first internal network address included in the first data packet into the first external network address to obtain the second data packet; the implementation of step S305 can be found in the relevant description of step S203 above.
[0098] Step S306: Send a second data packet to the external network server. This is the same as step S205 above.
[0099] In the technical solution provided in this application embodiment, when the proxy dialing device finds the first external network address in the dynamic mapping table, it directly converts the first internal network address included in the first data packet into the first external network address, completes the address conversion and proxy dialing of the packet, and improves the efficiency of packet forwarding.
[0100] In some embodiments, during the process of a proxy user sending a message, after recording the target mapping relationship in the dynamic mapping table, the proxy device can also set the target mapping relationship to an active state; then, it can detect the state of the target mapping relationship in the dynamic mapping table; when the target mapping relationship is detected to be inactive, it can delete the target mapping relationship.
[0101] In this embodiment of the application, the dispatching device manages the dynamic mapping table in any of the following ways.
[0102] In Method 1, the dynamic mapping table records not only the mapping relationship between internal network addresses and external network addresses, but also the number of packets that use the mapping relationship for address translation, as shown in Table 1.
[0103] Table 1
[0104] Internal network address external address Number of messages
[0105] Here, the number of packets used for address translation using the mapping relationship represents the cumulative number of data packets that match the mapping relationship during the address translation process performed by the dialing device.
[0106] For example, the dynamic mapping table in the dispatch device is shown in Table 2.
[0107] Table 2
[0108] m1 n1 2 m2 n2 1
[0109] When the dialing device receives a data packet with source address m1, the first row of Table 2 records the mapping relationship including m1. That is, the data packet matches the first row of Table 2, and the number of packets recorded in the first row can be incremented by 1, as shown in Table 3.
[0110] Table 6
[0111] m1 n1 3 m2 n2 1
[0112] The proxy dialing device can read the number of target packets that use the target mapping relationship for address translation at preset intervals and clear the number of target packets; when the number of target packets read is less than the preset number for a preset number of consecutive times, it is determined that the target mapping relationship is in an inactive state.
[0113] In this embodiment, the preset duration can be set according to actual needs, for example, the preset duration can be 5 minutes, 10 minutes, or 15 minutes. The preset quantity can be set according to actual needs, for example, the preset quantity can be 3, 4, 5, or 6. The preset number can be set according to actual needs, for example, the preset number can be 0, 1, 2, or 3. The target packet count is the number of packets that undergo address translation using the target mapping relationship, that is, the number of packets corresponding to the target mapping relationship.
[0114] The dialing device can read the target packet count at preset intervals and clear the target packet count to re-accumulate the target packet count. When the target packet count is less than the preset number of times consecutively read, the dialing device can determine that the target mapping relationship is inactive and delete the target mapping relationship from the dynamic mapping table. If the number of times the target packet count is less than the preset number of times consecutively read is less than the preset number, the target mapping relationship can be determined to be active, and the target mapping relationship in the dynamic mapping table can be retained, that is, no processing is performed on the target mapping relationship.
[0115] Method 2: In addition to recording the mapping relationship between internal network addresses and external network addresses, the dynamic mapping table also records the time of the last address translation using the mapping relationship, as shown in Table 4.
[0116] Table 4
[0117] Internal network address external address Last time
[0118] Here, the last time refers to the time when the address translation was last performed using the mapping relationship, indicating the time when the last data packet matching the mapping relationship was received during the address translation process by the proxy device.
[0119] The proxy device can detect in real time the time of the last address translation using the target mapping relationship (i.e., the last time of the target); when the time from the last time of the target to the current time reaches the aging time, it is determined that the target mapping relationship is in an inactive state.
[0120] In this embodiment of the application, the aging time can be set according to actual needs. For example, the aging time can be 10 minutes, 15 minutes or 20 minutes.
[0121] Upon receiving a data packet that matches the target mapping relationship, the dispatching device updates the target's last time to the reception time of that data packet. The dispatching device can detect the last time in real time. When the duration from the target's last time to the current time reaches the aging period, the dispatching device can determine that the target mapping relationship is inactive and delete the target mapping relationship from the dynamic mapping table. If the duration from the target's last time to the current time has not reached the aging period, the target mapping relationship can be determined to be active, and the target mapping relationship in the dynamic mapping table is retained, meaning no processing is performed on the target mapping relationship.
[0122] In this embodiment of the application, the dispatching device may also manage the dynamic mapping table in other ways, and there are no limitations on this.
[0123] In this embodiment, the dialing device manages the dynamic mapping table and deletes inactive mapping relationships, thus saving storage space. Furthermore, deleting inactive mapping relationships reduces the number of invalid mapping relationships in the dynamic mapping table, improving the efficiency of the dialing device in matching and finding target mapping relationships, and ultimately improving packet forwarding efficiency.
[0124] In some embodiments, within the address prefix range allocated by the external network server, unallocated available addresses are recorded in the doubly linked list corresponding to the external network server; after deleting the target mapping relationship, the dialing device adds the first external network address to the tail of the doubly linked list.
[0125] In this embodiment, the dialing device uses a doubly linked list to maintain unallocated available addresses within the address prefix range allocated by the external network server, thereby improving the maintenance efficiency of unallocated available addresses.
[0126] In this embodiment, unassigned available addresses within the address prefix range allocated by the external network server form an address pool. After deleting the target mapping relationship, the proxy device can add the first external network address to the address pool.
[0127] The proxy device can also use other methods to maintain unassigned available addresses within the address prefix range allocated by the external network server, and there are no restrictions on this.
[0128] The following is combined Figure 1 The dial-up network shown and Figure 4 The message forwarding signaling interaction flow shown herein provides a detailed description of the message forwarding method provided in this application embodiment.
[0129] Assuming, Figure 1 In the internal network address prefix range, addresses include m1 to mm. The service servers in Operator 1's network allocate shared address prefixes for the internal network, and the available addresses within this prefix range include n1 to nn. The dial-up device uses a doubly linked list to maintain these addresses, such as... Figure 5 As shown in the diagram. Here, m can be greater than n, equal to n, or less than n. Taking device 1 with address m1 and service server 1 in operator 1's network with address ad1 as an example.
[0130] In step S401, device 1 sends data packet 1 to BRAS1. Data packet 1 includes a source address of m1 and a destination address of ad1.
[0131] In step S402, BRAS1 searches the dynamic mapping table for mapping relationship 1 that includes m1. If mapping relationship 1 is not found, proceed to step S403; if mapping relationship 1 is found, proceed to step S405.
[0132] In step S403, BRAS1 removes the available address from the head of the doubly linked list. Then, steps S404 and S405 are executed.
[0133] like Figure 5 As shown, the available address of the head of the doubly linked list is n1. BRAS1 removes the address n1 from the head of the doubly linked list.
[0134] In step S404, BRAS1 records the mapping relationship 1 between m1 and n1 in the dynamic mapping table. At this time, mapping relationship 1 is in an active state.
[0135] In step S405, BRAS1 accumulates the number of packets corresponding to mapping relationship 1, and converts the source address included in data packet 1 to n1 to obtain data packet 2. That is, the source address included in data packet 2 is n1, and the destination address included in data packet 2 is ad1. The number of packets corresponding to mapping relationship 1 is the number of packets that use mapping relationship 1 for address translation. The initial value of the number of packets that use mapping relationship 1 for address translation is 0.
[0136] Step S406, BRAS1 sends data packet 2 to BRAS2.
[0137] After receiving data packet 2, BRAS2 forwards data packet 2 to service server 1 according to the forwarding table or flow table, so that device 1 can access service server 1.
[0138] After receiving data packet 2, service server 1 sends data packet 3 to BRAS1. Data packet 3 includes the source address ad1 and the destination address n1. Upon receiving data packet 3, BRAS1 looks up mapping relationship 1 in the dynamic mapping table, obtains m1 corresponding to n1, converts the destination address in data packet 3 to m1, and obtains data packet 4. The destination address in data packet 4 is then converted back to m1. BRAS1 then sends data packet 4 to device 1 according to the forwarding table or flow table, etc.
[0139] In step S407, BRAS1 detects the status of mapping relationship 1 in the dynamic mapping table; if mapping relationship 1 is detected to be in an inactive state, step S408 is executed; if mapping relationship 1 is detected to be in an active state, the current process ends.
[0140] After recording mapping relationship 1 in the dynamic mapping table, BRAS1 can periodically check the status of mapping relationship 1.
[0141] In step S408, BRAS1 deletes mapping relationship 1 in the dynamic mapping table.
[0142] In step S409, BRAS1 adds n1 to the tail of the doubly linked list.
[0143] like Figure 5 As shown, BRAS1 adds the inactive state n1 to the tail of the doubly linked list, that is, after nn.
[0144] In this embodiment, the dialing device does not require the intranet and extranet to have the same network configuration, thus decoupling the intranet and extranet configurations and reducing the difficulty of network configuration; it uses complete available extranet addresses for address translation, solving the problem of address translation failure of intranet user devices.
[0145] In addition, by allocating and reclaiming external network addresses, such as removing the available address from the head of the doubly linked list and adding inactive addresses to the tail of the doubly linked list, the recycling of available external network addresses is achieved, ensuring that user devices in the internal network can access the external network.
[0146] In this application embodiment, the proxy dialing network supports scenarios where the proxy dialing user equipment and the operator's proxy dialing address prefix (i.e., external network address prefix) are different, or multiple proxy dialing user equipment use a shared prefix, and does not affect the needs for internet access monitoring, tracing, and auditing in the proxy dialing network.
[0147] Corresponding to the above message forwarding method, this application also provides a message forwarding device, such as... Figure 6 As shown, a dial-up device used in an intranet is configured with a dynamic mapping table, which stores the mapping relationship between intranet addresses and extranet addresses; the device includes:
[0148] The receiving module 601 is used to receive a first data packet sent by a user equipment in the intranet. The source address of the first data packet is a first intranet address, and the destination address of the first data packet is the address of an external network server.
[0149] The lookup module 602 is used to look up the first external network address corresponding to the first internal network address in the dynamic mapping table;
[0150] The allocation module 603 is used to select an unallocated available address from the address prefix range allocated by the external network server as the first external network address if the first external network address is not found.
[0151] The conversion module 604 is used to record the target mapping relationship between the first internal network address and the first external network address in the dynamic mapping table, and convert the first internal network address included in the first data packet into the first external network address to obtain the second data packet;
[0152] The sending module 605 is used to send a second data packet to an external network server.
[0153] In some embodiments, such as Figure 6 As shown, the conversion module 604 is also used to convert the first internal network address included in the first data packet into the first external network address if the first external network address is found, so as to obtain the second data packet.
[0154] In some embodiments, within the address prefix range allocated by the external network server, unallocated available addresses are recorded in the doubly linked list corresponding to the external network server.
[0155] The allocation module 603 can be used to remove the available address from the head of the doubly linked list and use it as the first external network address.
[0156] In some embodiments, the allocation module 603 can also be used to set the target mapping relationship to an active state after recording the target mapping relationship in the dynamic mapping table; detect the state of the target mapping relationship in the dynamic mapping table; and delete the target mapping relationship when it is detected that the target mapping relationship is in an inactive state.
[0157] In some embodiments, the dynamic mapping table also records the number of packets that use the mapping relationship for address translation;
[0158] The allocation module 603 can be used to read the number of target packets that are address translated using the target mapping relationship at preset intervals and clear the number of target packets; when the number of target packets read is less than the preset number for a preset number of consecutive times, it is determined that the target mapping relationship is in an inactive state.
[0159] In some embodiments, within the address prefix range allocated by the external network server, unallocated available addresses are recorded in the doubly linked list corresponding to the external network server.
[0160] The allocation module 603 can also be used to add the first external network address to the tail of the doubly linked list after deleting the target mapping relationship.
[0161] In the technical solution provided in this application, after receiving a data packet sent by a user equipment in the intranet to an external server, the dial-up device replaces the complete source address included in the data packet with a complete externally available address from the address prefix range allocated by the external server, instead of simply performing address prefix translation. In this case, it is not required that the number of complete available addresses in the address prefix range allocated by the external server be proportional to the number of addresses needed by the intranet user equipment, thus reducing the difficulty of network configuration.
[0162] Furthermore, the technical solution provided in this application uses complete external network available addresses for address translation. Each external network available address is unique and usable, so that the addresses obtained by different internal network user devices after address translation will not be the same or unusable, thereby solving the problem of address translation failure of internal network user devices.
[0163] Corresponding to the above message forwarding method, this application embodiment also provides a dialing proxy device, such as... Figure 7 As shown, it includes a processor 701 and a machine-readable storage medium 702, the machine-readable storage medium 702 storing machine-executable instructions that can be executed by the processor 701, the processor 701 being prompted by the machine-executable instructions to implement any of the above-described message forwarding methods.
[0164] Machine-readable storage media may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the machine-readable storage medium may also be at least one storage device located remotely from the aforementioned processor.
[0165] The processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0166] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements any of the above-described message forwarding methods.
[0167] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the above-described message forwarding methods.
[0168] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, 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.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can 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)).
[0169] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0170] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, devices, storage media, and program products are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0171] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. A message forwarding method, characterized in that, A dial-up proxy device applied in an intranet, wherein the proxy device is configured with a dynamic mapping table, the dynamic mapping table storing the mapping relationship between intranet addresses and extranet addresses; the method includes: Receive a first data packet sent by a user equipment in the intranet, wherein the source address of the first data packet is a first intranet address and the destination address of the first data packet is the address of an external network server; Find the first external network address corresponding to the first internal network address in the dynamic mapping table; If the first external network address is not found, then a complete and available address that has not been assigned is selected from the address prefix range allocated by the external network server as the first external network address. The target mapping relationship between the first intranet address and the first extranet address is recorded in the dynamic mapping table, and the first intranet address included in the first data packet is converted into the first extranet address to obtain the second data packet; The second data packet is sent to the external network server.
2. The method according to claim 1, characterized in that, The method further includes: If the first external network address is found, the first internal network address included in the first data packet is converted to the first external network address to obtain the second data packet; The second data packet is sent to the external network server.
3. The method according to claim 1, characterized in that, Within the address prefix range allocated by the external network server, unallocated available addresses are recorded in the doubly linked list corresponding to the external network server. The step of selecting an unassigned available address from the address prefix range allocated by the external network server as the first external network address includes: The usable address at the head of the doubly linked list is removed and used as the first external network address.
4. The method according to any one of claims 1-3, characterized in that, The method further includes: After recording the target mapping relationship in the dynamic mapping table, the target mapping relationship is set to an active state; Detect the status of the target mapping relationship in the dynamic mapping table; When the target mapping relationship is detected to be inactive, the target mapping relationship is deleted.
5. The method according to claim 4, characterized in that, The dynamic mapping table also records the number of packets that use the mapping relationship for address translation; The detection of the state of the target mapping relationship in the dynamic mapping table includes: At preset intervals, the number of target packets that have undergone address translation using the target mapping relationship is read, and the number of target packets is cleared. When the number of target messages read consecutively is less than a preset number, the target mapping relationship is determined to be in an inactive state.
6. The method according to claim 4, characterized in that, Within the address prefix range allocated by the external network server, unallocated available addresses are recorded in the doubly linked list corresponding to the external network server. After deleting the target mapping relationship, the method further includes: Add the first external network address to the tail of the doubly linked list.
7. A message forwarding device, characterized in that, A proxy dialing device used in an intranet, wherein the proxy dialing device is configured with a dynamic mapping table, the dynamic mapping table storing the mapping relationship between intranet addresses and extranet addresses; the device includes: The receiving module is used to receive a first data packet sent by a user equipment in the intranet, wherein the source address of the first data packet is a first intranet address and the destination address of the first data packet is the address of an external network server. The lookup module is used to look up the first external network address corresponding to the first internal network address in the dynamic mapping table; The allocation module is used to select an unallocated, complete, and available address from the address prefix range allocated by the external network server as the first external network address if the first external network address is not found. The conversion module is used to record the target mapping relationship between the first intranet address and the first extranet address in the dynamic mapping table, and convert the first intranet address included in the first data packet into the first extranet address to obtain the second data packet; The sending module is used to send the second data packet to the external network server.
8. The apparatus according to claim 7, characterized in that, The conversion module is further configured to, if the first external network address is found, convert the first internal network address included in the first data packet to the first external network address to obtain the second data packet.
9. The apparatus according to claim 7, characterized in that, Within the address prefix range allocated by the external network server, unallocated available addresses are recorded in the doubly linked list corresponding to the external network server. The allocation module is specifically used to remove the available address from the head of the doubly linked list and use it as the first external network address.
10. The apparatus according to any one of claims 7-9, characterized in that, The allocation module is further configured to, after recording the target mapping relationship in the dynamic mapping table, set the target mapping relationship to an active state; and detect the state of the target mapping relationship in the dynamic mapping table. When the target mapping relationship is detected to be inactive, the target mapping relationship is deleted.
11. The apparatus according to claim 10, characterized in that, The dynamic mapping table also records the number of packets that use the mapping relationship for address translation; The allocation module is specifically used to read the number of target packets that have undergone address translation using the target mapping relationship at preset intervals, and then clear the number of target packets. When the number of target messages read consecutively is less than a preset number, the target mapping relationship is determined to be in an inactive state.
12. The apparatus according to claim 10, characterized in that, Within the address prefix range allocated by the external network server, unallocated available addresses are recorded in the doubly linked list corresponding to the external network server. The allocation module is further configured to add the first external network address to the tail of the doubly linked list after deleting the target mapping relationship.
Citation Information
Patent Citations
Network address conversion method and chip
CN109218467A
Data reading method and device, and computer readable storage medium
CN112231241A