Lightweight ipv4 / ipv6 translation method and apparatus
By starting translation instances and creating virtual ports on the IPv4/IPv6 translation device, and configuring VRF routing tables and translation rules for each user, the problem of user isolation in IPv4/IPv6 translation is solved, enabling a lightweight and low-cost IPv4/IPv6 translation service.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 北京英迪瑞讯网络科技有限公司
- Filing Date
- 2024-06-12
- Publication Date
- 2026-04-24
AI Technical Summary
Traditional VRF technology cannot solve the user isolation problem of IPv4/IPv6 translation function, and deploying an IPv4/IPv6 translation device or virtual machine for each slice user leads to high resource consumption and increased network construction costs.
Start an IPv4/IPv6 translation instance on the IPv4/IPv6 translation device, create two virtual ports, create a user VRF routing table for each user, configure the corresponding translation rules, and implement user isolation and route forwarding through mark rules and VLAN sub-interfaces.
It achieves user isolation and IPv4/IPv6 translation isolation in multi-slice/multi-user environments, reduces resource consumption and network construction costs, and supports IPv4/IPv6 routing overlap scenarios.
Smart Images

Figure CN118612184B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of communication technology, and in particular to a lightweight IPv4 / IPv6 translation method and apparatus. Background Technology
[0002] When the same service provider or operator provides network services to multiple users, the addresses of different users may overlap. For example, different users may all use the 10.0.0.0 / 8 address range. Therefore, it is necessary to isolate different users in the routing plane to ensure that routes do not become confused or conflict. To solve this problem, a common practice in the field is to use VRF (Virtual Routing and Forwarding) to isolate the routes and traffic of different users. For example, when the same operator uses the same set of PE devices to provide services to multiple users, a separate VRF routing table is assigned to each user on each PE device, and the different VRF routing tables are isolated from each other. Different PE devices use RD (Route Distinguisher) and RT (Route Target) technologies to label routes in different VRFs in the routing control plane, and then synchronize the labeled routes. In the data plane, tunneling technologies such as L3VPN or VXLAN are used to directly connect the PE devices to each other, ensuring that the routes and traffic of different users do not overlap or become confused.
[0003] In scenarios where IPv4 and IPv6 coexist extensively, IPv4 / IPv6 translation is widely used. International standards RFC 6052 and RFC 7915 define the basic architecture of IPv4 / IPv6 translation algorithms. RFC 6052 defines the specifications for IPv4 / IPv6 address translation, while RFC 7915 defines the specifications for IPv4 / IPv6 protocol translation. When the same service provider or operator provides IPv4 / IPv6 translation services to multiple users, similar issues arise: because different users' IPv4 / IPv6 addresses may overlap, it is necessary to isolate different users in the IPv4 / IPv6 routing control plane and the IPv4 / IPv6 translation plane (data plane) to ensure that routing and service traffic do not become confused or conflict. For example, the FITI future network trial facility provides no fewer than 4096 core network slice resources by slicing within the same IPv6 physical backbone network. To address the IPv4 / IPv6 translation and interoperability requirements within each slice, as well as between slices, IPv4 / IPv6 translation devices need to be deployed on each node. When using these IPv4 / IPv6 translation devices to achieve routing and service traffic isolation for different users, the following challenges arise:
[0004] 1. Traditional VRF technology only solves the problem of IPv4 or IPv6 route isolation, but cannot solve the user isolation problem of IPv4 / IPv6 translation function;
[0005] 2. With a large number of slice users, deploying an IPv4 / IPv6 translation device or an IPv4 / IPv6 virtual machine for each slice user would consume a lot of resources and result in high network construction costs.
[0006] 3. Traditional IPv4 / IPv6 translation methods cannot solve the translation and routing isolation problems in multi-user scenarios. Summary of the Invention
[0007] In view of this, this application proposes a lightweight IPv4 / IPv6 translation method and apparatus to solve the above problems.
[0008] This application proposes a lightweight IPv4 / IPv6 translation method, including the following steps:
[0009] Start an IPv4 / IPv6 translation instance in the default VRF routing table of the IPv4 / IPv6 translation device and create two virtual ports;
[0010] A user VRF routing table is created for each user on the IPv4 / IPv6 translation device.
[0011] Configure corresponding translation rules according to the user's translation needs;
[0012] Connect each user's VRF routing table and the translation rule according to a preset method;
[0013] When an IPv4 packet or an IPv6 packet to be translated enters the IPv4 / IPv6 translation device, it matches the pre-configured mark rules, performs routing forwarding in the corresponding user VRF routing table, and then translates it into the corresponding IPv6 packet or IPv4 packet using the corresponding translation rules.
[0014] The translated IPv6 or IPv4 packets are received and routed using the corresponding virtual port.
[0015] As an optional implementation of this application, optionally, the step of connecting each user VRF routing table and the translation rule according to a preset method includes:
[0016] Configure corresponding IPv4 static routes and IPv6 static routes in each user VRF routing table, wherein the IPv4 static routes point to the IPv4 / IPv6 translation rules in the translation rules, and the IPv6 static routes point to the IPv6 / IPv4 translation rules in the translation rules;
[0017] Configure a corresponding mark rule for each user;
[0018] In the default VRF routing table, one IPv4 policy route and one IPv6 policy route are configured for each user.
[0019] As an optional implementation of this application, optionally, when the IPv4 packet or IPv6 packet to be translated enters the IPv4 / IPv6 translation device, matching the pre-configured mark rule, and performing route forwarding in the corresponding user VRF routing table, and then translating it into the corresponding IPv6 packet or IPv4 packet using the corresponding translation rule, includes:
[0020] When the IPv4 packet to be translated enters the IPv4 / IPv6 translation device, it is processed according to the pre-configured mark rules, stored in the pre-allocated mark value, and routed and forwarded in the corresponding user VRF routing table;
[0021] The IPv4 / IPv6 translation rule is determined based on the IPv4 static route matched with the IPv4 packet to be translated;
[0022] After translating the IPv4 packet to be translated using the IPv4 / IPv6 translation rules, the corresponding IPv6 packet is obtained.
[0023] As an optional implementation of this application, optionally, when the IPv4 packet or IPv6 packet to be translated enters the IPv4 / IPv6 translation device, after matching the pre-configured mark rule and performing route forwarding in the corresponding user VRF routing table, the packet is translated into the corresponding IPv6 packet or IPv4 packet using the corresponding translation rule, the process further includes:
[0024] When the IPv6 packet to be translated enters the IPv4 / IPv6 translation device, it is processed according to the pre-configured mark rules, stored in the pre-allocated mark value, and routed and forwarded in the corresponding user VRF routing table;
[0025] The IPv6 / IPv4 translation rule is determined based on the IPv6 static route matched with the IPv6 packet to be translated;
[0026] After translating the IPv6 packet to be translated using the IPv6 / IPv4 translation rules, the corresponding IPv4 packet is obtained.
[0027] As an optional implementation of this application, optionally, before configuring the corresponding translation rules according to the user's translation needs, the method further includes:
[0028] On the IPv4 / IPv6 translation device, a VLAN ID is created for each user, and a first VLAN sub-interface is created on the IPv4 physical port, and a second VLAN sub-interface is created on the IPv6 physical port; and the VLAN corresponding to the VLAN ID is either a single-layer VLAN or a dual-layer VLAN.
[0029] As an optional implementation of this application, optionally, when the IPv4 packet or IPv6 packet to be translated enters the IPv4 / IPv6 translation device, after matching the pre-configured mark rule and performing route forwarding in the corresponding user VRF routing table, the packet is translated into the corresponding IPv6 packet or IPv4 packet using the corresponding translation rule, the process further includes:
[0030] Identify the VLAN ID of the IPv4 packet or the IPv6 packet to be translated, and match it with the first VLAN sub-interface or the second VLAN sub-interface.
[0031] As an optional implementation of this application, the step of receiving the translated IPv6 packet or IPv4 packet using the corresponding virtual port for routing and forwarding may further include:
[0032] The translated IPv4 packet is received using the first virtual port in the virtual port;
[0033] Based on the queried IPv4 policy route matching, the corresponding user is determined by the mark value of the IPv4 packet, and IPv4 route forwarding is performed in the user's user VRF routing table.
[0034] As an optional implementation of this application, optionally, the step of receiving the translated IPv6 packet or the IPv4 packet using the corresponding virtual port for routing and forwarding includes:
[0035] The translated IPv6 packet is received using the second virtual port in the virtual port;
[0036] Based on the queried IPv6 policy route matching, the corresponding user is determined by the mark value of the IPv6 packet, and IPv6 routing is performed in the user's user VRF routing table.
[0037] As an optional implementation of this application, optionally, before the step of matching the pre-configured mark rule and routing the IPv4 or IPv6 packet to be translated into the corresponding IPv6 or IPv4 packet according to the corresponding translation rule when the IPv4 / IPv6 translation device enters the device, further includes:
[0038] Obtain the mapped IPv4 address or IPv6 address of the peer computer, and send the corresponding IPv4 packet or IPv6 packet to be translated.
[0039] Add a VLAN tag to the IPv4 packet or the IPv6 packet to be translated.
[0040] In another aspect, this application provides an apparatus for implementing the lightweight IPv4 / IPv6 translation method described in any of the preceding claims, comprising:
[0041] The translation instance startup module is configured to start an IPv4 / IPv6 translation instance in the default VRF routing table of the IPv4 / IPv6 translation device and create two virtual ports;
[0042] The user VRF routing table creation module is configured to create a user VRF routing table for each user on the IPv4 / IPv6 translation device.
[0043] The translation rule configuration module is configured to configure corresponding translation rules based on the user's translation needs.
[0044] The translation rule integration module is configured to connect each user's VRF routing table and the translation rule in a preset manner;
[0045] The message translation module is configured to, when an IPv4 message or an IPv6 message to be translated enters the IPv4 / IPv6 translation device, match the pre-configured mark rules, perform routing forwarding in the corresponding user VRF routing table, and then translate it into the corresponding IPv6 message or IPv4 message using the corresponding translation rules.
[0046] The routing and forwarding module is configured to receive the translated IPv6 packets or the IPv4 packets using the corresponding virtual port and then forward them.
[0047] Technical effects of the present invention:
[0048] In the IPv4 / IPv6 translation device of this application, an IPv4 / IPv6 translation instance is started in the default VRF routing table, and two virtual ports are created to receive translated IPv6 or IPv4 packets for routing and forwarding. Furthermore, the IPv4 / IPv6 translation device also creates a user routing table for each user and configures corresponding translation rules according to translation requirements. That is, in the IPv4 / IPv6 translation device of this application, after an IPv4 or IPv6 packet to be translated enters the device from the IPv4 or IPv6 physical port, the packet is matched against pre-configured mark rules. Specifically, the mark value corresponding to the user is stored in the operating system's packet storage data structure, and routing and forwarding are performed in the corresponding user's VRF routing table. This allows for routing and IPv4 / IPv6 translation isolation for multiple slices / users with only one IPv4 / IPv6 translation instance configured, overcoming the limitations of traditional VRF and traditional IPv4 / IPv6 translation.
[0049] Other features and aspects of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description
[0050] The accompanying drawings, which are included in and form part of this specification, illustrate exemplary embodiments, features, and aspects of this disclosure together with the specification and serve to explain the principles of this disclosure.
[0051] Figure 1 The diagram shown is a schematic flowchart of a lightweight IPv4 / IPv6 translation method according to an embodiment of this disclosure;
[0052] Figure 2 The diagram shows the connection relationships between the entities in the lightweight IPv4 / IPv6 translation method according to an embodiment of this disclosure. Detailed Implementation
[0053] Various exemplary embodiments, features, and aspects of this disclosure will now be described in detail with reference to the accompanying drawings. The same reference numerals in the drawings denote elements that have the same or similar functions. Although various aspects of the embodiments are shown in the drawings, they are not necessarily drawn to scale unless specifically indicated otherwise.
[0054] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.
[0055] Furthermore, to better illustrate this disclosure, numerous specific details are set forth in the following detailed description. Those skilled in the art will understand that this disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art have not been described in detail in order to highlight the main points of this disclosure.
[0056] While traditional methods create virtual interfaces within the operating system and utilize the operating system's IPv4 / IPv6 routing mechanism to configure multiple IPv4 / IPv6 translation rules, this only addresses the issue of configuring different translation rules for different users' IPv4 / IPv6 translation needs. It fails to resolve the problems of IPv4 / IPv6 address conflicts and overlaps between different users before and after IPv4 / IPv6 translation. In contrast, the lightweight IPv4 / IPv6 translation method for user isolation provided in this application enables lightweight IPv4 / IPv6 translation with user isolation in multi-slice / multi-user environments.
[0057] Example 1
[0058] like Figure 1 As shown, this application proposes a lightweight IPv4 / IPv6 translation method, including the following steps:
[0059] S100. Start an IPv4 / IPv6 translation instance in the default VRF routing table of the IPv4 / IPv6 translation device and create two virtual ports;
[0060] In this step, an IPv4 / IPv6 translation instance needs to be started in the default VRF routing table of the IPv4 / IPv6 translation device, and two virtual ports need to be created. These virtual ports include a first virtual port and a second virtual port. It should be noted that the first virtual port is used to receive IPv4 traffic and forward it to the IPv4 / IPv6 translation rule, while the second virtual port is used to receive IPv6 traffic and forward it to the IPv6 / IPv4 translation rule. Furthermore, the first virtual port is configured with an internal IPv4 address, and the second virtual port is configured with an internal IPv6 address.
[0061] S200: Create a user VRF routing table for each user on the IPv4 / IPv6 translation device;
[0062] In this step, a VRF routing table needs to be created for each user on the IPv4 / IPv6 translation device. This user VRF routing table can be used to configure IPv4 and IPv6 routes later.
[0063] S300: Configure corresponding translation rules according to the user's translation needs;
[0064] In this step, the corresponding IPv4 / IPv6 translation rules or IPv6 / IPv4 translation rules are configured according to the user's IPv4 / IPv6 translation requirements. Furthermore, each translation rule is assigned a corresponding number in this step.
[0065] For example, the parameter list of a translation rule is: ID, prefix-src, prefix-dst, nexthop-ipv4, nexthop-ipv6; where ID is the translation rule number, and different translation rules have different numbers; prefix-src is the source address translation prefix for IPv4-IPv6 translation (according to RFC6052, the source IPv4 address plus this prefix becomes the translated source IPv6 address), and it is also the destination address translation prefix for IPv6-IPv4 translation; prefix-dst is the destination address translation prefix for IPv4-IPv6 translation (according to RFC6052, the destination IPv4 address plus this prefix becomes the translated destination IPv6 address), and it is also the source address translation prefix for IPv6-IPv4 translation; nexthop-ipv4 is an internal IPv4 address. If the next hop of any static route matches nexthop-ipv6, it will match this translation rule with the number ID for IPv4 / IPv6 translation. Different translation rules have different `nexthop-ipv4` values. `nexthop-ipv6` is an internal IPv6 address. When the next hop of any static route matches `nexthop-ipv6`, it will match the current translation rule with the ID number for IPv6 / IPv4 translation. Different translation rules have different `nexthop-ipv6` values. It should be noted that the `prefix-src` and `prefix-dst` values of different translation rules can be the same, contain each other, or overlap. This allows different users to configure translation rules with the same or overlapping address parameters, as long as the translation rule's ID, `nexthop-ipv4`, and `nexthop-ipv6` are different.
[0066] S400: Connect each user's VRF routing table and translation rules according to a preset method;
[0067] In this step, for each user, the user VRF routing table from step S200 is connected to the translation rules configured in step S300, so that the IPv4 / IPv6 translation rules or IPv6 / IPv4 translation rules and the VRF routing table are connected. This enables routing isolation for multiple users and IPv4 / IPv6 translation isolation, and also supports scenarios where IPv4 / IPv6 routes overlap.
[0068] When an IPv4 or IPv6 packet to be translated enters the IPv4 / IPv6 translation device, the S500 matches the pre-configured mark rules, performs routing forwarding in the corresponding user VRF routing table, and then translates it into the corresponding IPv6 or IPv4 packet using the appropriate translation rules.
[0069] In this step, when the IPv4 packet or IPv6 packet to be translated enters the IPv4 / IPv6 translation device, the corresponding user VRF routing table is used to route and forward the packet to be translated, and the packet is translated based on the translation rules connected to the user VRF routing table, thereby obtaining the corresponding IPv6 packet or IPv4 packet.
[0070] The S600 uses the corresponding virtual port to receive translated IPv6 or IPv4 packets for routing and forwarding.
[0071] In this step, the received translated IPv6 or IPv4 packets are routed and forwarded using the corresponding virtual ports, thereby forwarding the translated packets to the corresponding destination address and achieving end-to-end IPv4 / IPv6 interconnection.
[0072] Therefore, in the IPv4 / IPv6 translation device of this application, an IPv4 / IPv6 translation instance is started in the default VRF routing table, and a first virtual port and a second virtual port are created to receive translated IPv6 packets or IPv4 packets for routing and forwarding. Furthermore, the IPv4 / IPv6 translation device also creates a user routing table for each user and configures corresponding translation rules according to translation requirements. That is, in the IPv4 / IPv6 translation device of this application, after the IPv4 or IPv6 packet to be translated enters the IPv4 / IPv6 translation device from the IPv4 physical port or IPv6 physical port, the packet is matched against pre-configured mark rules. Specifically, the mark value corresponding to the user is stored in the operating system's packet storage data structure, and routing is performed in the corresponding user's VRF routing table, such as VRF1 IPv4, VRF2 IPv4, VRF3 IPv4, or VRF1 IPv6, VRF2 IPv6, VRF3 IPv6. The IPv4 packets to be translated follow the found route, entering the default VRF from the user VRF. They are then translated into corresponding IPv6 packets by the appropriate IPv4 / IPv6 translation rules, such as IPv4 / IPv6 translation rule 1, IPv4 / IPv6 translation rule 2, and IPv4 / IPv6 translation rule 3, and sent to the second virtual port. The second virtual port then forwards the received translated IPv6 packets. Similarly, the IPv6 packets to be translated follow the found route, entering the default VRF from the user VRF. They are then translated into corresponding IPv4 packets by the appropriate IPv6 / IPv4 translation rules and sent to the first virtual port. The first virtual port then forwards the received translated IPv6 packets. Therefore, this application provides a lightweight IPv4 / IPv6 translation method for user isolation. It can achieve routing and IPv4 / IPv6 translation isolation for multiple slices / users with only one IPv4 / IPv6 translation instance configured, overcoming the limitations of traditional VRFs and traditional IPv4 / IPv6 translation methods.
[0073] As an optional implementation of this application, the VRF routing table and translation rules for each user can be connected in a preset manner, including: configuring corresponding IPv4 static routes and IPv6 static routes in each user's VRF routing table, wherein the IPv4 static routes point to the IPv4 / IPv6 translation rules in the translation rules, and the IPv6 static routes point to the IPv6 / IPv4 translation rules in the translation rules; configuring corresponding mark rules for each user; and configuring one IPv4 policy route and one IPv6 policy route for each user in the default VRF routing table.
[0074] In other words, the connection method of the user VRF routing table and translation rules in this application specifically includes: First, assigning a unique mark value to each user, and the mark values of each user are different from each other. Then, in the VRF to which each user belongs, configuring the corresponding IPv4 static route pointing to the translation rule. In this static route, the target subnet is the IPv4 subnet mapped from IPv6 computer / network, the next hop is nexthop-ipv4, and the next hop port is the first virtual port. Since the IPv4 / IPv6 translation instance originates in the default VRF, and the first virtual port is also in the default VRF, this IPv4 static route is a VRF traversal static route, that is, traversing from the user's VRF to the default VRF. For example, in Linux, a typical static route configuration is: `ip route add [target subnet] via [nexthop-ipv4] dev [virtual port 1] vrf [user VRF]`. Furthermore, in the VRF to which each user belongs, configuring the corresponding IPv6 static route pointing to the translation rule. In this static route, the target subnet is an IPv6 subnet mapped from IPv4 computer / network, the next hop is nexthop-ipv6, and the next hop port is the second virtual port. Since the IPv4 / IPv6 translation instance originates in the default VRF, and the second virtual port is also in the default VRF, this IPv6 static route is a VRF traversal static route, that is, from the user's VRF to the default VRF. In Linux, a typical static route configuration is: ip-6route add [target subnet]via [nexthop-ipv6]dev [virtual port 2]vrf [user VRF].
[0075] Furthermore, for each user, a corresponding mark rule is configured. It should be noted that in this embodiment, a VLAN ID is also created for each user on the IPv4 / IPv6 translation device, and a corresponding first VLAN sub-interface is created on the IPv4 physical port, and a corresponding second VLAN sub-interface is created on the IPv6 physical port. The addresses of the first and second VLAN sub-interfaces need to be properly connected and consistent with their uplink switches / routers. The aforementioned VLAN sub-interfaces are added to the VRF corresponding to this user. That is, packets received from this VLAN sub-interface are automatically matched with routes in the corresponding VRF routing table and forwarded. In other words, the VLAN sub-interface processes the IPv4 or IPv6 packets to be translated, storing pre-allocated mark values in the operating system's packet storage data structure (e.g., struct sk_buff in Linux, struct mbuf in BSD) before routing and forwarding.
[0076] Furthermore, in the default VRF routing table, each user is configured with one IPv4 policy route and one IPv6 policy route. The IPv6 policy route matches IPv6 packets received from the second virtual port after IPv4 / IPv6 translation. If the mark value in the packet matches the user's mark value, the IPv6 packet is routed and forwarded in the user's corresponding VRF routing table. The IPv4 policy route matches IPv4 packets received from the first virtual port after IPv6 / IPv4 translation. If the mark value in the IPv4 packet matches the user's mark value, the IPv4 packet is routed and forwarded in the user's corresponding VRF routing table.
[0077] Therefore, it can be seen that the method in this embodiment enables the integration of IPv4 / IPv6 translation rules and VRF routing tables, which can achieve multi-user routing isolation and IPv4 / IPv6 translation isolation, and can also support scenarios where IPv4 / IPv6 routes overlap.
[0078] As an optional implementation of this application, before configuring the corresponding translation rules according to the user's translation needs, the method may further include: creating a VLAN ID for each user on the IPv4 / IPv6 translation device, and creating a first VLAN sub-interface on the IPv4 physical port and a second VLAN sub-interface on the IPv6 physical port; and the VLAN corresponding to the VLAN ID is either a single-layer VLAN or a double-layer VLAN.
[0079] It should be noted that the VLANs in this application include both single-layer VLANs (IEEE 802.1Q) and double-layer VLANs (IEEE 802.1AD). If the number of VLANs is less than or equal to 4094, VLANs are sufficient. If the number of VLANs exceeds 4094, such as 4096 in the FITI example, double-layer VLAN technology QinQ is required. QinQ has a 24-bit VLAN ID, which is longer than the normal 12-bit VLAN ID. Furthermore, this application creates a first VLAN sub-interface on the IPv4 physical port of the translation device and a second VLAN sub-interface on the IPv6 physical port. The address of the first VLAN sub-interface needs to be consistent with the uplink switch / router for proper connection. That is, when an IPv4 computer or network wants to access an IPv6 computer or network through the IPv4 / IPv6 translation device of this application, after the IPv4 computer or network sends the IPv4 packet to be translated, it passes through the router / switch, reaches the IPv4 physical port, and is matched with the corresponding first VLAN sub-interface, allowing the packet to enter through the first VLAN sub-interface. It should also be noted that the address of the second sub-interface must be consistent with that of the upstream switch / router for proper connection. The specific process of an IPv6 computer / network accessing an IPv4 computer / network through the IPv4 / IPv6 translation device of this application should be adjusted according to the above description of an IPv4 computer / network accessing an IPv6 computer / network through the IPv4 / IPv6 translation device of this application. Repeated parts will not be repeated.
[0080] It should also be noted that in one scenario, if the IPv4 VLAN ID and the IPv6 VLAN ID are the same, then the first VLAN sub-interface and the second VLAN sub-interface can be the same VLAN sub-interface (or they can be two VLAN sub-interfaces).
[0081] As an optional implementation scheme of this application, when the IPv4 packet or IPv6 packet to be translated enters the IPv4 / IPv6 translation device, the device matches the pre-configured mark rule, performs routing forwarding in the corresponding user VRF routing table, and then translates it into the corresponding IPv6 packet or IPv4 packet using the corresponding translation rule. The device also includes: identifying the VLAN ID of the IPv4 packet or IPv6 packet to be translated and matching it with the first VLAN sub-interface or the second VLAN sub-interface.
[0082] As an optional implementation scheme of this application, optionally, when an IPv4 packet or an IPv6 packet to be translated enters the IPv4 / IPv6 translation device, it matches a pre-configured mark rule, performs routing forwarding in the corresponding user VRF routing table, and then translates it into the corresponding IPv6 packet or IPv4 packet using the corresponding translation rule. This includes: when an IPv4 packet to be translated enters the IPv4 / IPv6 translation device, processing the IPv4 packet to be translated according to the pre-configured mark rule, storing the pre-allocated mark value, and performing routing forwarding in the corresponding user VRF routing table; determining the IPv4 / IPv6 translation rule based on the IPv4 static route matched by the IPv4 packet to be translated; and translating the IPv4 packet to be translated using the IPv4 / IPv6 translation rule to obtain the corresponding IPv6 packet.
[0083] It should be noted that when an IPv4 packet to be translated enters the IPv4 / IPv6 translation device of this application, the IPv4 / IPv6 translation device identifies the VLAN ID of the IPv4 packet to be translated and matches it with the corresponding first VLAN sub-interface. The IPv4 packet to be translated enters from the corresponding first VLAN sub-interface, matches the pre-configured mark rule, stores the corresponding mark value for this user in the operating system's storage data structure, and performs routing forwarding in the corresponding user's VRF routing table. It should be noted that in this embodiment, the destination address of the IPv4 packet to be translated is a mapped address. Therefore, the packet will match a pre-configured IPv4 static route (VRF traversing static routes), pointing to a corresponding IPv4 / IPv6 translation rule. Subsequently, the IPv4 packet to be translated follows the queried route, enters the default VRF from the user VRF, is translated into an IPv6 packet by the corresponding IPv4 / IPv6 translation rule, and is sent to the second virtual port.
[0084] As an optional implementation scheme of this application, optionally, when the IPv4 packet or IPv6 packet to be translated enters the IPv4 / IPv6 translation device, after matching the pre-configured mark marking rules and performing route forwarding in the corresponding user VRF routing table, it is translated into the corresponding IPv6 packet or IPv4 packet using the corresponding translation rules. The scheme further includes: when the IPv6 packet to be translated enters the IPv4 / IPv6 translation device, processing the IPv6 packet to be translated according to the pre-configured mark marking rules, storing the pre-allocated mark value, and performing route forwarding in the corresponding user VRF routing table; determining the IPv6 / IPv4 translation rule based on the IPv6 static route matched by the IPv6 packet to be translated; and translating the IPv6 packet to be translated using the IPv6 / IPv4 translation rule to obtain the corresponding IPv4 packet.
[0085] It should be noted that when an IPv6 packet to be translated enters the IPv4 / IPv6 translation device of this application, the IPv4 / IPv6 translation device identifies the VLAN ID of the IPv6 packet to be translated and matches it with the corresponding second VLAN sub-interface. The IPv6 packet to be translated enters from the corresponding second VLAN sub-interface, matches the pre-configured mark rule, stores the corresponding mark value for this user in the operating system's storage data structure, and performs routing forwarding in the corresponding user's VRF routing table. It should be noted that in this embodiment, the destination address of the IPv6 packet to be translated is a mapped address. Therefore, the packet will match a pre-configured IPv6 static route (VRF traversing static routes), pointing to a corresponding IPv6 / IPv4 translation rule. Subsequently, the IPv6 packet to be translated follows the queried route, enters the default VRF from the user VRF, is translated into an IPv4 packet by the corresponding IPv6 / IPv4 translation rule, and is sent to the first virtual port.
[0086] As an optional implementation of this application, the method of receiving translated IPv6 packets or IPv4 packets using a corresponding virtual port for routing and forwarding may include: receiving translated IPv4 packets using a first virtual port in the virtual ports; determining the corresponding user based on the mark value of the IPv4 packet matched with the queried IPv4 policy route, and performing IPv4 routing and forwarding in the user's user VRF routing table.
[0087] It should be noted that after the IPv6 packet to be translated is translated into the corresponding IPv4 packet using the corresponding IPv6 / IPv4 translation rules, the first virtual port receives the translated IPv4 packet and performs routing forwarding. Specifically, it queries the pre-configured IPv4 policy route, matches the packet's mark value to a certain user, then forwards the packet using the user's corresponding user VRF routing table for IPv4 routing, and finally sends it to the IPv4 computer / network.
[0088] As an optional implementation of this application, the corresponding virtual port is used to receive the translated IPv6 packets or IPv4 packets for routing and forwarding, including: using the second virtual port in the virtual port to receive the translated IPv6 packets; determining the corresponding user based on the mark value of the IPv6 packets matched by the queried IPv6 policy route, and performing IPv6 routing and forwarding in the user's user VRF routing table.
[0089] It should be noted that after the IPv4 packet to be translated is translated into the corresponding IPv6 packet using the corresponding IPv4 / IPv6 translation rules, the second virtual port receives the translated IPv6 packet and performs routing forwarding. Specifically, it queries the pre-configured IPv6 policy route, matches the packet's mark value to a specific user, then forwards the packet using the user's corresponding user VRF routing table for IPv6 routing, and finally sends it to the IPv6 computer / network.
[0090] As an optional implementation scheme of this application, optionally, when the IPv4 packet or IPv6 packet to be translated enters the IPv4 / IPv6 translation device, before matching the pre-configured mark tagging rule and performing route forwarding in the corresponding user VRF routing table, and before translating it into the corresponding IPv6 packet or IPv4 packet using the corresponding translation rule, the method further includes: obtaining the mapped IPv4 address or IPv6 address of the peer computer, and sending the IPv4 packet or IPv6 packet to be translated accordingly; adding a VLAN tag to the IPv4 packet or IPv6 packet to be translated.
[0091] Specifically, such as Figure 2 As shown, when an IPv4 computer accesses an IPv6 computer through the IPv4 / IPv6 translation device of this application, the entities involved include the IPv4 computer / network, the IPv6 computer / network, the switch / router, and the IPv4 / IPv6 translation device. First, the IPv4 computer / network needs to obtain the mapped IPv4 address of the peer IPv6 computer / network, which can be obtained through DNS translation or any offline method. Then, the IPv4 computer sends an IPv4 packet (to be translated) to the aforementioned IPv4 address. After being tagged with a VLAN tag by the router / switch, the packet arrives at the IPv4 physical port of the IPv4 / IPv6 translation device. The device identifies the VLAN ID of the IPv4 packet to be translated and matches it with the corresponding VLAN sub-interface, allowing the packet to enter through the VLAN sub-interface. It then matches the mark rule, stores the corresponding mark value for the user, and forwards the packet in the corresponding user VRF routing table. Furthermore, following the found route, the packet enters the default VRF from the user's VRF. After translation by the corresponding translation rules, it is sent to the second virtual port. The second virtual port uses this port to route and forward the translated IPv6 packet. It then queries the configured IPv6 policy route, matches the packet's mark value to a specific user, and subsequently forwards the packet using the user's corresponding routing table for IPv6 routing, ultimately sending it to the IPv6 computer. This completes the entire process of an IPv4 computer accessing an IPv6 computer through the IPv4 / IPv6 translation device described in this application.
[0092] It should also be noted that when an IPv6 computer accesses an IPv4 computer through the aforementioned IPv4 / IPv6 translation device, the IPv6 computer obtains the mapped IPv6 address of the peer IPv4 computer (obtained through DNS translation or offline). The IPv6 computer then sends an IPv6 packet (to be translated) to this IPv6 address. After being tagged with a VLAN tag by a router / switch, the packet arrives at the IPv6 physical port of the IPv4 / IPv6 translation device. This causes the packet to enter through the second VLAN sub-interface, be translated according to the corresponding translation rules, and then sent to the first virtual port. The first virtual port uses this port to route the translated IPv4 packet, query the configured corresponding IPv4 policy route, match the packet's mark value to a specific user, and then use the user's corresponding routing table for IPv4 routing forwarding, finally sending it to the IPv4 computer. This completes the entire process of an IPv6 computer accessing an IPv4 computer through the IPv4 / IPv6 translation device described in this application.
[0093] In summary, this application provides a lightweight IPv4 / IPv6 translation method for user isolation. It enables routing and IPv4 / IPv6 translation isolation for multiple slices / users based on a single IPv4 / IPv6 translation instance. User isolation in IPv4 / IPv6 translation and IPv4 / IPv6 routing isolation can be linked to achieve end-to-end user isolation for IPv4 / IPv6 interconnection, overcoming the limitations of traditional VRF and traditional IPv4 / IPv6 translation. Furthermore, this application only requires configuring one IPv4 / IPv6 translation instance. Through VRF traversal, multiple users can share a single IPv4 / IPv6 translation instance, but different IPv4 / IPv6 translation rules can be configured for each user. This achieves a lightweight, low-cost, and cost-effective IPv4 / IPv6 translation service, solving the problem of high complexity associated with creating a separate IPv4 / IPv6 translation virtual machine for each user.
[0094] It should be noted that although the above description is provided as an example, those skilled in the art will understand that this disclosure is not limited thereto. In fact, users can flexibly configure the settings according to actual application scenarios, as long as the technical functions of this application can be achieved by following the above technical methods.
[0095] Example 2
[0096] Based on the implementation principle of Embodiment 1, this application, in another aspect, provides an apparatus for implementing the lightweight IPv4 / IPv6 translation method described in any of the above claims, comprising:
[0097] The translation instance startup module is configured to start an IPv4 / IPv6 translation instance in the default VRF routing table of the IPv4 / IPv6 translation device and create two virtual ports;
[0098] The user VRF routing table creation module is configured to create a user VRF routing table for each user on the IPv4 / IPv6 translation device.
[0099] The translation rule configuration module is configured to configure corresponding translation rules based on the user's translation needs.
[0100] The translation rule integration module is configured to connect each user's VRF routing table and the translation rule in a preset manner;
[0101] The message translation module is configured to, when an IPv4 message or an IPv6 message to be translated enters the IPv4 / IPv6 translation device, match the pre-configured mark rules, perform routing forwarding in the corresponding user VRF routing table, and then translate it into the corresponding IPv6 message or IPv4 message using the corresponding translation rules.
[0102] The routing and forwarding module is configured to receive the translated IPv6 packets or the IPv4 packets using the corresponding virtual port and then forward them.
[0103] Obviously, those skilled in the art should understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the control methods described above. The modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device, or fabricating them separately as individual integrated circuit modules, or fabricating multiple modules or steps into a single integrated circuit module. Thus, the present invention is not limited to any specific hardware and software combination.
[0104] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the control methods described above. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium can also include combinations of the above types of memory.
[0105] Example 3
[0106] Furthermore, in another aspect, this application provides a control system, comprising:
[0107] processor;
[0108] Memory used to store processor-executable instructions;
[0109] The processor is configured to implement the lightweight IPv4 / IPv6 translation method described above when executing the executable instructions.
[0110] This disclosure discloses an embodiment of a system including a processor and a memory for storing processor-executable instructions. The processor is configured to implement any of the lightweight IPv4 / IPv6 translation methods described above when executing the executable instructions.
[0111] It should be noted here that the number of processors can be one or more. Furthermore, the control system in this embodiment may also include input devices and output devices. The processors, memory, input devices, and output devices can be connected via a bus or other means, without specific limitations herein.
[0112] The memory, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and various modules, such as the program or module corresponding to the lightweight IPv4 / IPv6 translation method of this disclosure. The processor executes various functional applications and data processing of the control system by running the software programs or modules stored in the memory.
[0113] Input devices can be used to receive input digital numbers or signals. These signals can be key signals related to user settings and function control of the device / terminal / server. Output devices can include display devices such as screens.
[0114] Example 4
[0115] In another aspect, this application provides a non-volatile computer-readable storage medium storing computer program instructions thereon, which, when executed by a processor, implement the lightweight IPv4 / IPv6 translation method described in any of the preceding claims.
[0116] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A lightweight IPv4 / IPv6 translation method, characterized in that, Includes the following steps: Start an IPv4 / IPv6 translation instance in the default VRF routing table of the IPv4 / IPv6 translation device and create two virtual ports; On the IPv4 / IPv6 translation device, a user VRF routing table is created for each user, enabling multi-user routing isolation and IPv4 / IPv6 translation isolation. Configure corresponding translation rules according to the user's translation needs; Connect each user's VRF routing table and the translation rule according to a preset method; When an IPv4 packet or an IPv6 packet to be translated enters the IPv4 / IPv6 translation device, it matches the pre-configured mark rules, performs routing forwarding in the corresponding user VRF routing table, and then translates it into the corresponding IPv6 packet or IPv4 packet using the corresponding translation rules. The translated IPv6 or IPv4 packets are received and routed using the corresponding virtual port. The step of connecting each user VRF routing table and the translation rule in a preset manner includes: configuring corresponding IPv4 static routes and IPv6 static routes in each user VRF routing table, wherein the IPv4 static routes point to the IPv4 / IPv6 translation rules in the translation rules, and the IPv6 static routes point to the IPv6 / IPv4 translation rules in the translation rules; Configure a corresponding mark rule for each user; In the default VRF routing table, one IPv4 policy route and one IPv6 policy route are configured for each user.
2. The lightweight IPv4 / IPv6 translation method according to claim 1, characterized in that, When an IPv4 packet or IPv6 packet to be translated enters the IPv4 / IPv6 translation device, it matches the pre-configured mark rules, performs routing forwarding in the corresponding user VRF routing table, and then translates it into the corresponding IPv6 packet or IPv4 packet using the corresponding translation rules, including: When the IPv4 packet to be translated enters the IPv4 / IPv6 translation device, it is processed according to the pre-configured mark rules, stored in the pre-allocated mark value, and routed and forwarded in the corresponding user VRF routing table; The IPv4 / IPv6 translation rule is determined based on the IPv4 static route matched with the IPv4 packet to be translated; After translating the IPv4 packet to be translated using the IPv4 / IPv6 translation rules, the corresponding IPv6 packet is obtained.
3. The lightweight IPv4 / IPv6 translation method according to claim 1, characterized in that, When an IPv4 packet or IPv6 packet to be translated enters the IPv4 / IPv6 translation device, it matches a pre-configured mark rule, performs routing forwarding in the corresponding user VRF routing table, and then translates it into the corresponding IPv6 packet or IPv4 packet using the corresponding translation rule. The process further includes: When the IPv6 packet to be translated enters the IPv4 / IPv6 translation device, it is processed according to the pre-configured mark rules, stored in the pre-allocated mark value, and routed and forwarded in the corresponding user VRF routing table; The IPv6 / IPv4 translation rule is determined based on the IPv6 static route matched with the IPv6 packet to be translated; After translating the IPv6 packet to be translated using the IPv6 / IPv4 translation rules, the corresponding IPv4 packet is obtained.
4. The lightweight IPv4 / IPv6 translation method according to claim 1, characterized in that, Before configuring the corresponding translation rules according to the user's translation needs, the following is also included: On the IPv4 / IPv6 translation device, a VLAN ID is created for each user, and a first VLAN sub-interface is created on the IPv4 physical port, and a second VLAN sub-interface is created on the IPv6 physical port; and the VLAN corresponding to the VLAN ID is either a single-layer VLAN or a dual-layer VLAN.
5. The lightweight IPv4 / IPv6 translation method according to claim 4, characterized in that, When an IPv4 packet or IPv6 packet to be translated enters the IPv4 / IPv6 translation device, it matches a pre-configured mark rule, performs routing forwarding in the corresponding user VRF routing table, and then translates it into the corresponding IPv6 packet or IPv4 packet using the corresponding translation rule. The process further includes: Identify the VLAN ID of the IPv4 packet or the IPv6 packet to be translated, and match it with the first VLAN sub-interface or the second VLAN sub-interface.
6. The lightweight IPv4 / IPv6 translation method according to claim 1, characterized in that, The step of receiving the translated IPv6 packet or IPv4 packet using the corresponding virtual port for routing and forwarding also includes: The translated IPv4 packet is received using the first virtual port in the virtual port; Based on the queried IPv4 policy route matching, the corresponding user is determined by the mark value of the IPv4 packet, and IPv4 route forwarding is performed in the user's user VRF routing table.
7. The lightweight IPv4 / IPv6 translation method according to claim 6, characterized in that, The step of receiving the translated IPv6 packet or IPv4 packet using the corresponding virtual port for routing and forwarding includes: The translated IPv6 packet is received using the second virtual port in the virtual port; Based on the queried IPv6 policy route matching, the corresponding user is determined by the mark value of the IPv6 packet, and IPv6 routing is performed in the user's user VRF routing table.
8. The lightweight IPv4 / IPv6 translation method according to any one of claims 1-7, characterized in that, Before translating an IPv4 or IPv6 packet into the corresponding IPv4 / IPv6 packet using the corresponding translation rules after matching the pre-configured mark rules and performing route forwarding in the corresponding user VRF routing table when the packet enters the IPv4 / IPv6 translation device, the process further includes: Obtain the mapped IPv4 address or IPv6 address of the peer computer, and send the corresponding IPv4 packet or IPv6 packet to be translated. Add a VLAN tag to the IPv4 packet or the IPv6 packet to be translated.
9. An apparatus for implementing the lightweight IPv4 / IPv6 translation method according to any one of claims 1-8, characterized in that, include: The translation instance startup module is configured to start an IPv4 / IPv6 translation instance in the default VRF routing table of the IPv4 / IPv6 translation device and create two virtual ports; The user VRF routing table creation module is configured to create a user VRF routing table for each user on the IPv4 / IPv6 translation device. The translation rule configuration module is configured to configure corresponding translation rules based on the user's translation needs. The translation rule integration module is configured to connect each user's VRF routing table and the translation rule in a preset manner; The message translation module is configured to, when an IPv4 message or an IPv6 message to be translated enters the IPv4 / IPv6 translation device, match the pre-configured mark rules, perform routing forwarding in the corresponding user VRF routing table, and then translate it into the corresponding IPv6 message or IPv4 message using the corresponding translation rules. The routing and forwarding module is configured to receive the translated IPv6 packets or the IPv4 packets using the corresponding virtual port and then forward them.