A packet forwarding method and a gateway device
By using configuration scripts and listening scripts in gateway devices, the IPv4 over IPv6 tunnels are automatically configured and managed, and the problems of high configuration complexity and low efficiency in the existing technology are solved, and fast and automated tunnel configuration and dynamic adjustment are achieved, improving network service quality.
Patent Information
- Application Number
- CN202211573088.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-08
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2042-12-08
AI Technical Summary
In the prior art, realizing the IPv4 over IPv6 tunnel function requires professionals to perform complex configuration operations, resulting in long configuration time, high cost, and high professional requirements for configuration personnel, which affects the tunnel creation efficiency and function activation efficiency.
By presetting configuration scripts and page configuration information in the gateway device, the IPv4 over IPv6 tunnel is automatically configured, which reduces the complexity and cost of manual configuration, and monitors network status information through monitoring scripts, and dynamically adjusts the tunnel configuration to adapt to network changes.
It realizes fast and automated tunnel configuration, reduces the professional dependence on configuration personnel, saves configuration time, improves the creation efficiency and function activation efficiency of IPv4 over IPv6 tunnels, and improves the quality of network services.
Smart Images

Figure CN115914143B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technologies, and particularly to a method for packet forwarding and a gateway device. Background Art
[0002] A tunnel is a kind of encapsulation technology. It uses one network protocol to transmit another network protocol, that is, it uses a network transmission protocol to encapsulate data packets generated by other protocols in its own packets and then transmit them in the network. A tunnel is a virtual point-to-point connection. A Tunnel provides a path for the encapsulated data packets to be transmitted, and the data packets can be encapsulated and decapsulated at both ends of a Tunnel respectively. The tunnel technology refers to the whole process including data encapsulation, transmission, and decapsulation.
[0003] The tunnel technology is an important means for the transition from IPv4 to IPv6. Due to the exhaustion of IPv4 addresses and the advancement of IPv6, the transition from IPv4 to IPv6 is inevitable. Because of the incompatibility between IPv6 and IPv4, it is necessary to replace the original IPv4 devices. However, the cost required for a large-scale replacement of IPv4 devices will be extremely huge, and the services running in the existing network will also be interrupted, which is obviously not feasible. Therefore, the transition from IPv4 to IPv6 is a gradual process.
[0004] In the initial stage of the transition, a large number of IPv4 networks have been deployed, while IPv6 networks are just "islands" scattered everywhere. The IPv6 over IPv4 tunnel enables IPv6 packets to be transmitted in the IPv4 network through the tunnel technology, realizing the interconnection of the islands between IPv6 networks. In the later stage of the transition from the IPv4 network to the IPv6 network, a large number of IPv6 networks have been deployed, and at this time, IPv4 islands may appear. The tunnel technology can be used to create tunnels on the IPv6 network, thereby realizing the interconnection of IPv4 islands. This is similar to deploying a VPN on the IP network using the tunnel technology. The tunnel used to connect IPv4 islands on the IPv6 network is called an IPv4 over IPv6 tunnel. The IPv4 over IPv6 tunnel can connect IPv4 end-users through a fast and efficient IPv6 backbone network to improve the quality of network services.
[0005] The basic idea of the IPv4 over IPv6 technology is to add an IPv6 packet header to the IPv4 packet to encapsulate it into an IPv6 packet. Figure 1 It is a schematic diagram of a topology scenario for packet forwarding through an IPv4 over IPv6 tunnel. As Figure 1As shown in the figure, device A and device B are connected through an IPv4 network, device C and device D are connected through an IPv4 network, and device B and device C are connected through an IPv6 network. Both device B and device C belong to gateway devices. Taking the example of a message being gradually forwarded from device A to device D, device A first forwards the IPv4 message to device B, which encapsulates it to form an IPv6 message. After the IPv6 message is transmitted to device C, device C decapsulates it into an IPv4 message, and then device C forwards the decapsulated IPv4 message to device D. When completing the above process, the IPv4 over IPv6 tunnel established between device B and device C is crucial.
[0006] In traditional gateway devices, in order to enable the IPv4 over IPv6 tunnel function, complex configuration operations need to be performed by professional personnel in advance. For example, it is necessary to first configure the IPv6 addresses of the local and remote ends of the tunnel, bind the physical network card at the exit, and configure the local IP of the tunnel on the physical network card. At the same time, configure routing, etc. for traffic diversion. The complexity of the configuration operation greatly consumes the configuration time, affects the creation efficiency of the IPv4 over IPv6 tunnel and the enabling efficiency of its function, and places high requirements on the professional level of the configuration personnel, resulting in a high manual configuration cost. Summary of the Invention
[0007] Based on the above problems, the present application provides a message forwarding method and related devices to reduce the manual configuration complexity for implementing the IPv4 over IPv6 tunnel function, reduce the professional requirements for configuration personnel, and save configuration time.
[0008] The embodiments of the present application disclose the following technical solutions:
[0009] In a first aspect, a message forwarding method is proposed. The message forwarding method is applied to a gateway device in an IPv4 over IPv6 network scenario, and the two sides of the gateway device are respectively connected to an IPv4 network and an IPv6 network. The message forwarding method includes:
[0010] In response to a tunnel configuration instruction, configure an IPv4 over IPv6 tunnel based on page configuration information and a configuration script; wherein, the page configuration information includes the identification information and remote information of the IPv4 over IPv6 tunnel, and the configuration script is a pre-written script for configuring the IPv4 over IPv6 tunnel;
[0011] Forward messages through the IPv4 over IPv6 tunnel.
[0012] In an optional implementation manner, after the configuration script completes the configuration of the IPv4 over IPv6 tunnel, the method further includes:
[0013] Run a monitoring script for monitoring the status information of the network;
[0014] After determining the dynamic changes that occur in the network based on the monitored status information, output network change information, and / or adjust the configuration information of the IPv4 over IPv6 tunnel.
[0015] In an alternative implementation, configure the IPv4 over IPv6 tunnel based on page configuration information and a configuration script, including:
[0016] Configure the remote IPv6 address of the IPv4 over IPv6 tunnel according to the remote information;
[0017] Create a virtual network card;
[0018] Use the local interface configuration information of the gateway device and the virtual network card to configure traffic diversion for the IPv4 over IPv6 tunnel.
[0019] In an alternative implementation, use the local interface configuration information of the gateway device and the virtual network card to configure traffic diversion for the IPv4 over IPv6 tunnel, including:
[0020] Determine the external network interface and internal network interface configured for the gateway device according to the local interface configuration information;
[0021] Resolve the local IPv6 address based on the external network interface and configure the local IPv6 address for the IPv4 over IPv6 tunnel;
[0022] Configure the route so that traffic accessing the remote IPv6 address is sent to the external network interface;
[0023] Bind the IPv4 over IPv6 tunnel and the virtual network card.
[0024] In an alternative implementation, after determining the external network interface and internal network interface configured for the gateway device according to the local interface configuration information, the method further includes:
[0025] Configure the virtual network card to borrow the IPv4 address of the internal network interface.
[0026] Optionally, the status information includes at least one of the following:
[0027] The local interface change information of the gateway device, the local network change information, or the remote network change information;
[0028] When the status information includes the local interface change information of the gateway device, the adjusted configuration information of the IPv4 over IPv6 tunnel includes: routing configuration information and / or virtual network card configuration information;
[0029] When the status information includes remote network change information, the adjusted configuration information of the IPv4 over IPv6 tunnel includes: the remote IPv6 address.
[0030] In an alternative implementation, listening for the local interface change information of the gateway device includes:
[0031] Determining the external network interface and the internal network interface configured for the gateway device according to the local interface configuration information of the gateway device;
[0032] Comparing whether the actually monitored external network interface is consistent with the external network interface configured for the gateway device. If not, it is determined that the external network interface has changed; comparing whether the actually monitored internal network interface is consistent with the internal network interface configured for the gateway device. If not, it is determined that the internal network interface has changed;
[0033] Adjusting the configuration information of the IPv4 over IPv6 tunnel includes:
[0034] If the external network interface has changed, modifying the route to send the traffic accessing the remote IPv6 address to the newly configured external network interface; if the internal network interface has changed, configuring the virtual network card to borrow the IPv4 address of the newly configured actual internal network interface.
[0035] In an alternative implementation, listening for the local network change information includes:
[0036] When it is monitored that the IPv6 address assigned to the local public network has changed, it is determined that the local IPv6 address has changed;
[0037] The output network change information includes:
[0038] Sending a notification that the local IPv6 address has changed to the remote end of the IPv4 over IPv6 tunnel.
[0039] In an alternative implementation, listening for the remote network change information includes:
[0040] Listening for whether the remote IPv6 address of the IPv4 over IPv6 tunnel has changed, and / or, listening for the connectivity of the remote IPv6 address of the IPv4 over IPv6 tunnel;
[0041] Outputting network change information, and / or, adjusting the configuration information of the IPv4 over IPv6 tunnel includes:
[0042] If it is monitored that the remote IPv6 address has changed, modify the configuration of the remote IPv6 address of the IPv4 over IPv6 tunnel;
[0043] If it is monitored that the remote IPv6 address is not connected, send a log about the failure of the IPv6 network.
[0044] In an optional implementation, after the configuration script completes the configuration of the IPv4 over IPv6 tunnel, start the monitoring script once every preset time interval.
[0045] In a second aspect, a gateway device is proposed. The gateway device is applied in an IPv4 over IPv6 network scenario. The two sides of the gateway device are respectively connected to an IPv4 network and an IPv6 network; the gateway device includes: a processor and a storage medium;
[0046] Wherein, the storage medium stores a computer program;
[0047] The processor is used to run the computer program, and when the computer program runs, it executes the packet forwarding method of any implementation manner proposed in the first aspect.
[0048] Compared with the prior art, the present application has the following beneficial effects:
[0049] In the previous IPv4 over IPv6 network environment, if packet forwarding needs to be implemented, a large number of configuration operations need to be performed by professionals, and the configuration operations are complex and inefficient. Through the technical solution of the present application, only with the help of the underlying configuration script and a small amount of configuration information (such as the identifier of the tunnel and the remote information of the tunnel), the tunnel configuration can be completed. The automated configuration implementation solution reduces the complexity of the configuration operation and the manual configuration cost, reduces the dependence on the professionalism of the configuration personnel and effectively saves the manual configuration time, and improves the creation efficiency of the IPv4 over IPv6 tunnel and the enabling efficiency of its functions. In addition, it is beneficial to improve the quality of network services. In addition, this solution also monitors the status information of the network through the monitoring script, outputs the network change information and / or adjusts the tunnel configuration after determining the dynamic changes of the network, and supports the tunnel configuration and packet forwarding in the scenario of network dynamic changes. Description of the Drawings
[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0051] Figure 1 It is a schematic diagram of a topological scenario for packet forwarding through an IPv4 over IPv6 tunnel;
[0052] Figure 2 It is a flowchart of a packet forwarding method provided by an embodiment of the present application;
[0053] Figure 3 It is a schematic diagram of the execution process of a configuration script provided by an embodiment of the present application;
[0054] Figure 4 It is a flowchart of another packet forwarding method provided by an embodiment of the present application;
[0055] Figure 5 It is a flowchart of an implementation method for a listening script to monitor network dynamic changes provided by an embodiment of the present application;
[0056] Figure 6 It is a functional architecture diagram of a gateway device provided by an embodiment of the present application;
[0057] Figure 7 It is a schematic diagram of the structure of a gateway device provided by an embodiment of the present application. Detailed implementation manners
[0058] As described above, in order to enable the IPv4 over IPv6 tunnel function, many configuration operations need to be performed manually by professionals. On the one hand, the operation complexity is relatively high, which puts forward high requirements for the professionalism of personnel and the configuration cost is high; on the other hand, the configuration efficiency is low, resulting in low tunnel creation efficiency and function enabling efficiency.
[0059] In view of the above problems, an embodiment of the present application provides a solution. When it is necessary to configure an IPv4 over IPv6 tunnel to implement the packet forwarding function in an IPv4 over IPv6 network, the method of executing a configuration script is adopted to replace the manual configuration operation. The amount of manual configuration operation is greatly reduced, and the operation complexity is also reduced. Other personnel with relatively low professional knowledge reserves can also complete the configuration work. The dependence on the professionalism of the IPv4 over IPv6 tunnel configuration personnel is reduced. And this solution can also improve the configuration efficiency and promote the further optimization of network service quality.
[0060] To enable those skilled in the art to better understand the solution of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this application.
[0061] In the foregoing, the device composition and network layout of the specific scenario for implementing packet forwarding through the IPv4 over IPv6 tunnel are introduced in combination with Figure 1 As an example, device A is a terminal device, both device B and device C are gateway devices, and device D is a server. The packet forwarding method in the embodiments of this application is mainly applied to Figure 1 the gateway device in the scenario shown. The gateway device is divided into a local end and a remote end. For example, device B is the local end, and device C is the gateway device at the remote end of device B. Similarly, if device C is regarded as the local end, then device B serves as the gateway device at the remote end of device C. Therefore, the local end and the remote end are only relative and do not specifically refer to. For the device itself that processes packets, itself is the local end, and the other gateway device in this scenario serves as the remote end of the IPv4 over IPv6 tunnel.
[0062] Figure 2 It is a flowchart of a packet forwarding method provided by an embodiment of this application. This packet forwarding method is applied to a gateway device in an IPv4 over IPv6 network scenario, such as Figure 1 device B or device C shown in Figure 2 As shown, the packet forwarding method includes the following steps:
[0063] S201, in response to a tunnel configuration instruction, configure an IPv4 over IPv6 tunnel based on page configuration information and a configuration script.
[0064] In the technical solution of this application, a pre-written configuration script is preset in the gateway device. The configuration script is a script for configuring an IPv4 over IPv6 tunnel. Personnel still need to perform a small amount of configuration work, such as providing a small amount of information on the configuration page to facilitate the smooth progress of the configuration work when executing the configuration script later.
[0065] In an example implementation, text boxes for typing tunnel identification information and remote information (such as remote DNS domain name or remote IPv6 address) are provided on the configuration page. When the user finishes filling in the information in the above text boxes and triggers the confirmation button on the configuration page, a tunnel configuration instruction is generated accordingly. In response to the tunnel configuration instruction, tunnel configuration is started. The information filled in by these users on the configuration page can be collectively referred to as page configuration information. It includes at least the identification information and remote information of the IPv4 over IPv6 tunnel. Here, the IPv4 over IPv6 tunnel refers to the IPv4 over IPv6 tunnel that needs to be constructed and configured. For example, an identification information (ID) of 001 means that an IPv4 over IPv6 tunnel with an identification information of 001 needs to be constructed and configured.
[0066] The above is only an example implementation of triggering the generation of a tunnel configuration instruction. In actual applications, tunnel configuration instructions can also be generated based on other trigger conditions. For example, when it is detected that the gateway device is restarted after a fault repair, or a notification that the tunnel communication anomaly has been repaired is obtained, a configuration instruction is generated. Invoking the configuration script means having a requirement to configure an IPv4 over IPv6 tunnel through the current gateway device.
[0067] The process of configuring a tunnel mainly involves the following points:
[0068] 1) Configure the remote IPv6 address of the IPv4 over IPv6 tunnel according to the remote information.
[0069] Since the page configuration information contains the remote information provided by the user, the remote IPv6 address can be configured through the result of parsing or directly reading the remote information. If the remote information is a domain name, the domain name is first parsed, and then the parsed address is configured as the remote IPv6 address. If the remote information itself is an address information, the address information is configured as the remote IPv6 address.
[0070] 2) Create a virtual network card.
[0071] The creation of the virtual network card is an important part of the tunnel creation process. The virtual network card can introduce traffic into the IPv4 over IPv6 tunnel.
[0072] 3) Use the local interface configuration information of the gateway device and the virtual network card to configure traffic diversion for the IPv4 over IPv6 tunnel.
[0073] In the embodiments of the present application, the local interface configuration information of the gateway device can be obtained through the interface configuration component, which generally includes the configuration information of the external network interface (WAN-side interface) and the internal network interface (LAN-side interface). Based on this information and the virtual network card created previously, the drainage configuration for the IPv4 over IPv6 tunnel can be performed. For example, after determining the external network interface and the internal network interface configured for the gateway device according to the local interface configuration information, the local IPv6 address is resolved according to the external network interface, and the local IPv6 address is configured for the IPv4 over IPv6 tunnel. In addition, the route is configured so that the traffic accessing the remote IPv6 address is sent to the external network interface. Combining Figure 1 As can be seen, for the local gateway device, the remote gateway device belongs to the WAN-side device (i.e., the device for external network communication). The two need to be connected through the IPv4 over IPv6 tunnel to complete the forwarding of packets. By configuring the route so that the traffic accessing the remote IPv6 address is sent to the external network interface, it can assist the packets to be smoothly transmitted from the local gateway device to the remote gateway device on the WAN side, thus conforming to the transmission path of the tunnel. In addition, as an indispensable link in the drainage setting, it is also necessary to bind the IPv4 over IPv6 tunnel and the virtual network card, so as to establish the association between the virtual network card and the IPv4 over IPv6 tunnel.
[0074] In practical applications, the binding relationship between the virtual network card and the tunnel can be one-to-many or one-to-one. For example, there is a binding relationship between virtual network card 1 and tunnel 001, and virtual network card 1 can introduce the traffic of the packets into tunnel 001. Another example is that both tunnel 001 and tunnel 002 are bound to virtual network card 1, and virtual network card 1 can select a currently suitable tunnel according to the usage conditions or communication quality of the two bound tunnels to complete the introduction of the packet traffic.
[0075] To support the local and remote IPv4 network communication of the gateway device, an IPv4 address also needs to be configured on the tunnel. However, in the IPv4 over IPv6 network scenario, there is usually no public IPv4 address. Therefore, an additional special IPv4 address needs to be occupied in the basic configuration of the gateway device to be configured for this tunnel. Since an additional special IPv4 address is occupied, the remaining available amount of the already scarce IPv4 address space becomes even more tense. To address this issue, the embodiments of this application provide a solution: after determining the internal network interface, use the IP unnumbered technology to configure a virtual network card to borrow the IPv4 address of the internal network interface. The IP unnumbered technology can provide the function of borrowing addresses, avoiding address waste. In the embodiments of this application, this technology is adopted to complete the configuration of the local IPv4 address of the virtual network card. Borrowing the IPv4 address of the internal network interface can avoid wasting the IPv4 address of the gateway device and save the IPv4 address resources of this gateway device.
[0076] Combined with the implementation content of this step described above, for easy understanding, reference can be made to Figure 3 . Figure 3 FIG. is a schematic diagram of the execution process of a configuration script provided by the embodiments of this application. First, create a tunnel, and then configure the IPv6 address of the tunnel remote end according to the remote information. Next, create a virtual network card, and after the linkage interface configuration component obtains the local interface configuration information, determine the internal network interface and the external network interface. Use the IP unnumbered technology to configure the virtual network card to borrow the IPv4 address of the internal network interface, and configure the route so that the traffic accessing the IPv6 address of the tunnel remote end is sent to the external network interface. Finally, bind the tunnel and the virtual network card to complete the full set of configurations of the IPv4 over IPv6 tunnel by this configuration script.
[0077] S202, forward packets through the IPv4 over IPv6 tunnel.
[0078] When the foregoing step S201 is executed and completed, the creation of the IPv4 over IPv6 tunnel is completed, which is equivalent to successfully building a Figure 1 traffic transmission channel between the two gateway devices B and C shown. In this way, when it is necessary to forward packets from one gateway device to another gateway device, the created and configured tunnel can be directly used to achieve packet forwarding between the two.
[0079] In the previous IPv4 over IPv6 network environment, to implement packet forwarding, professional personnel needed to perform a large number of configuration operations. The configuration operations were complex and inefficient. Through the technical solution of this application, only by relying on the underlying configuration script and a small amount of configuration information (such as the identification of the tunnel and the remote information of the tunnel) can the tunnel configuration be completed. The automated configuration implementation solution reduces the complexity of the configuration operation and the manual configuration cost, reduces the dependence on the professionalism of the configuration personnel, effectively saves the manual configuration time, and improves the creation efficiency of the IPv4 over IPv6 tunnel and the enabling efficiency of its functions. In addition, it is beneficial to improve the quality of network services.
[0080] The solution for configuring the IPv4 over IPv6 tunnel has the characteristic of relatively high configuration complexity, and the configuration method is difficult to be flexibly applied to the scenarios where the network changes dynamically. As a result, in the scenarios where the network changes dynamically, it is difficult to adapt to the above dynamic changes through simple and effective configuration operations. In addition, it is also difficult for the configuration personnel to accurately and timely identify that the network has changed dynamically. Furthermore, the quality of network services is affected. To solve this problem, in the technical solution of this application, another packet forwarding method is further proposed. The following will be described in combination with Figure 4 and embodiments for this method.
[0081] Figure 4 is a flowchart of another packet forwarding method provided by an embodiment of this application. As Figure 4 shown in the packet forwarding method, it includes the following steps:
[0082] S401, in response to the tunnel configuration instruction, configure the IPv4 over IPv6 tunnel based on the page configuration information and the configuration script.
[0083] S402, forward the packet through the IPv4 over IPv6 tunnel.
[0084] The implementation manners of the above steps S401 - S402 are basically the same as those of steps S201 - S202 in the foregoing embodiment. Therefore, the specific introduction here can refer to the foregoing embodiment. It will not be elaborated here.
[0085] To solve the problem that the network dynamic changes cannot be recognized in time, resulting in untimely solution and untimely configuration adjustment, which affects the communication quality, in the embodiment of this application, it is proposed that S403 can be started after the configuration of the IPv4 over IPv6 tunnel is completed. In this application, the execution order of S402 and S403 is not limited.
[0086] In an alternative implementation manner, the status information of the network is monitored by running a monitoring script to achieve the purpose of perceiving network changes.
[0087] The monitoring of network status information can be performed multiple times. For example, a monitoring script can be run at a preset time interval. After the configuration script completes the configuration of the IPv4 over IPv6 tunnel, the monitoring script is run once every preset time interval. As an example, the preset time interval is set to 300 seconds, that is, the monitoring script is run every 300 seconds. It should be noted that this time interval can be set according to actual monitoring requirements. If it is necessary to more timely identify the dynamic changes of the network, this time interval can be set smaller. Of course, this time interval can also be set according to historical configuration experience or the specific situation of network quality.
[0088] S403, run the monitoring script to monitor the network status information.
[0089] The network may undergo various types of changes. For example, the interface of the gateway device is plugged or unplugged, resulting in changes, local network changes, remote network changes, etc. Therefore, in the embodiments of the present application, monitoring can be performed from at least one of the above three aspects. The following introduces the monitoring methods one by one.
[0090] (1) Monitor the local interface change information of the gateway device:
[0091] In practical applications, it is possible that due to the plugging or unplugging of the interface of the gateway device, the actual interface after plugging or unplugging is different from the configured interface. To accurately monitor this change, first determine the external network interface and internal network interface configured for the gateway device according to the local interface configuration information (if there is a change, the user can accurately configure the physical interface on the interface configuration page). Then, for the external network interface, compare the actually monitored external network interface with the external network interface configured for the gateway device. If they are inconsistent, it is determined that the external network interface has changed. For the internal network interface, compare the actually monitored internal network interface with the internal network interface configured for the gateway device. If they are inconsistent, it is determined that the internal network interface has changed.
[0092] (2) Monitor the local network change information:
[0093] When the global IPv6 address changes, that is, it is monitored that the IPv6 address assigned to the local public network has changed, at this time it can be determined that the local IPv6 address has changed.
[0094] (3) Monitor the remote network change information:
[0095] For the remote network change information, it can be monitored separately in terms of the remote address and the connectivity of the tunnel remote address. In actual applications, either one of the two aspects can be selected for monitoring, or both aspects can be monitored. Therefore, in order to obtain the remote network change information, it is possible to monitor whether the remote IPv6 address of the IPv4 over IPv6 tunnel changes, and / or monitor the connectivity of the remote IPv6 address of the IPv4 over IPv6 tunnel.
[0096] S404, after determining the dynamic changes that occur in the network based on the monitored status information, output the network change information, and / or adjust the configuration information of the IPv4 over IPv6 tunnel.
[0097] For the status information of the network, the dynamic changes that occur in the network can be identified. On the one hand, the network change information can be output so that users or other devices can perceive this change. Additionally, the tunnel configuration can be adjusted based on the change information to maintain better network service quality. For network changes in different aspects, the specific means taken in this step are also different, and they will be introduced separately below.
[0098] (1) Monitor changes in the local interface of the gateway device. In the case where the status information includes local interface change information, the configuration of the IPv4 over IPv6 tunnel is adjusted in this step. The configuration information of the IPv4 over IPv6 tunnel that needs to be adjusted includes: routing configuration information and / or virtual network card configuration information.
[0099] The external network interface is related to the routing configuration. Therefore, the routing configuration is adjusted. The specific adjustment method is: if the external network interface changes, then modify the routing configuration so that the traffic accessing the remote IPv6 address is sent to the newly configured external network interface.
[0100] The internal network interface is related to the virtual network card configuration. Therefore, the configuration of the virtual network card is adjusted. The specific adjustment method is: if the internal network interface changes, then use the IP unnumbered technology to modify the configuration of the virtual network card to borrow the IPv4 address of the newly configured internal network interface.
[0101] (2) Monitor that changes occur in the local network. In the case where the status information includes local network change information, the local user does not need to perform any manual modification operations, and the traffic will automatically use the new local IPv6 address for tunnel transmission. However, in order for the remote end to also perceive the change in the local address, it is necessary to notify the remote gateway device of the address change information. The network change information output in this step includes: sending a notification to the remote end of the IPv4 over IPv6 tunnel that the local IPv6 address has changed.
[0102] Through this notice, the remote end can be informed in a timely manner of the change information of the local end's IPv6 address, thus avoiding communication problems caused by asymmetric messages between the two ends. If the gateway devices at both ends use a unified cloud configuration server, the local gateway device can upload the new local address information to the cloud configuration server, and then the cloud configuration server can transmit the information to the remote gateway device for automatic configuration. The same principle applies if the network at the other end changes.
[0103] (3) Detect that the remote network has changed. In the case where the status information includes the change information of the remote network, the configuration information of the IPv4 over IPv6 tunnel that needs to be adjusted includes: the remote IPv6 address. Specifically, if it is detected that the remote IPv6 address has changed, the remote IPv6 address configuration of the IPv4 over IPv6 tunnel is modified.
[0104] Regarding the connectivity problem, network change information can be output. An optional implementation method is: if it is detected that the remote IPv6 address is not connected, it means that the connection of the IPv4 over IPv6 tunnel between the local end and the remote end is interrupted, and it is necessary to send a log about the failure of the IPv6 network. Specifically, it can be sent to the user device or to a unified monitoring or management platform for the configuration personnel to view.
[0105] Figure 5 It is a flowchart of an implementation method for a monitoring script provided by an embodiment of the present application to monitor network dynamic changes. Combining Figure 5 Looking at it, in the embodiment of the present application, after the monitoring script starts monitoring, it first determines the external network interface and the internal network interface configured for the gateway device according to the local interface configuration information. Then, for the external network interface, it compares whether the actually monitored external network interface is the same as the external network interface configured for the gateway device. If they are not the same, it is determined that the external network interface has changed, and in this case, the routing is modified to configure the traffic accessing the remote IPv6 address to be sent to the newly configured external network interface. For the internal network interface, it compares whether the actually monitored internal network interface is the same as the internal network interface configured for the gateway device. If they are not the same, it is determined that the internal network interface has changed, and in this case, the IP unnumbered technology is used to modify the configuration to borrow the IPv4 address of the newly configured actual internal network interface for the virtual network card.
[0106] Next, it is determined whether the global IPv6 address has changed. If so, the tunnel remote end is notified of the change information of the local end IPv6 address. Monitoring whether the remote end IPv6 address of the IPv4 over IPv6 tunnel has changed can be achieved by resolving the domain name configured for the tunnel. If the address information obtained by resolving the domain name has changed, it indicates that the remote end address has changed. The remote end IPv6 address is modified to the current remote end IPv6 address, and the connectivity of the remote end IPv6 address is further detected. If it is not connected, a log is sent to report this problem. If no change is found after the above judgments, the above judgment steps are restarted again after waiting for a preset time interval.
[0107] It should be noted that in the embodiments of the present application, Figure 5 the steps of the various monitoring and judgment actions shown are not limited. Figure 5 Only one feasible execution order is exemplified.
[0108] In the above embodiments, after the configuration script completes the configuration of the IPv4 over IPv6 tunnel, the monitoring script is enabled to periodically monitor the status information of the network, which can facilitate timely perception of network changes and timely output of change information and / or adjustment of the configuration information of the IPv4 over IPv6 tunnel. This is beneficial to maintaining the stable connection of the tunnel, ensuring the quality of service of the IPv4 over IPv6 network, and providing a more stable packet forwarding service for users.
[0109] Figure 6 A functional architecture diagram of a gateway device is provided. As Figure 6 shown, the gateway device includes: a 4over6 tunnel configuration and monitoring module, a virtual network card and tunnel management module, a basic module, and a forwarding module. Among them, 4over6 is the abbreviation of IPv4 over IPv6. The full name of DPDK is Data Plane Development Kit, and its Chinese meaning is Data Plane Development Kit. The gateway device can complete packet receiving and packet sending actions through DPDK.
[0110] The main improvement point of the technical solution of the present application is located in the 4over6 tunnel configuration and monitoring module, which is a module that the existing gateway device does not have. As Figure 6 shown in the connection relationship of each module, the 4over6 tunnel configuration and monitoring module, the basic module, and the forwarding module are all connected to the virtual network card and tunnel management module; the 4over6 tunnel configuration and monitoring module and the forwarding module are also both connected to the basic module.
[0111] The 4over6 tunnel configuration and monitoring module has configuration scripts and monitoring scripts. After the user configures the 4over6 tunnel ID, the remote domain name, or the remote IPv6 address through the page, the platform will call the configuration script to perform unified configuration of the IPv4 over IPv6 network, reducing the complexity of manual operations for the user. After successful configuration, the monitoring script is started to monitor the 4over6 tunnel to sense and adapt to dynamic network changes. The specific configuration operations can refer to Figure 3 each step shown in Figure 5 each step shown. Through this monitoring script, it is possible to sense and handle dynamic network changes. For example, when the local device is plugged in or unplugged, causing the interface to change, the user only needs to change the external network interface and the internal network interface to the correct physical interface on the interface configuration page, and there is no need to change the configuration of the IPv4 over IPv6 tunnel. The monitoring script will automatically recognize the interface change and make corresponding modifications to the routing and address translation rules.
[0112] The virtual network card and tunnel management module mainly receives the configuration issued by the 4over6 tunnel configuration and monitoring module, stores tunnel and network card information, and at the same time provides the encapsulation and decapsulation function interfaces of the 4over6 tunnel for the forwarding module. When an IPv4 packet is sent by the forwarding module to the virtual network card, this module will find the bound 4over6 tunnel according to the configuration of the virtual network card, call the tunnel encapsulation interface, use the local IP as the source IP, and use the remote IPv6 address of the tunnel as the destination IP to perform packet encapsulation. After the encapsulation is completed, it is sent back to the packet receiving function of the forwarding protocol stack. When a locally received encapsulated IPv6 packet is received, the packet will be sent to this module, and the tunnel decapsulation interface will be called to compare the source IPv6 address parsed from the packet with all the remote IPv6 addresses configured for the tunnel to determine whether there is a corresponding tunnel. If not, the packet is discarded; if so, the IPv6 header is removed, and the packet entry is set to the virtual network card bound to the tunnel, and then sent back to the packet receiving function of the forwarding protocol stack.
[0113] The basic module includes the following multiple components:
[0114] (1) The IP unnumbered component
[0115] The main function of IP unnumbered is to provide the function of borrowing addresses to avoid address waste. In the network topology of IPv4 over IPv6, usually the IPv4 address is configured on the LAN side for internal network communication. However, if the device accesses the external network locally, it needs to use the exit, that is, the IPv4 address on the virtual network card bound to the tunnel is used as the source address. In this case, in order to avoid wasting addresses, the IP unnumbered technology can be used to make the packets sent locally borrow the IPv4 address of the LAN side network interface as the source.
[0116] (2) Local interface configuration component
[0117] When the gateway device initially accesses the network, the user needs to configure the relevant information of the internal and external network interfaces through the page, and the underlying layer will store the information in the local interface configuration component. The 4over6 tunnel configuration and monitoring module can read the information in this component.
[0118] (3) Domain name resolution component
[0119] Used to resolve domain names to IP addresses. In the present invention, it is mainly used for resolving the tunnel far-end address. This domain name resolution component can be called by the configuration script and monitoring script of the 4over6 tunnel configuration and monitoring module to obtain the far-end IPv6 address through resolution.
[0120] (4) Routing component
[0121] Used to determine the egress of traffic. In the present invention, it is mainly used for IPv4 traffic diversion and forwarding of encapsulated IPv6 packets.
[0122] The following introduces the forwarding module:
[0123] When the forwarding module receives a packet, it will first parse the packet, then query the session. If the session exists, it will directly forward according to the session. If not, it will query the route, create a session. When sending a packet, if it is determined that the egress is the virtual network card of IPv4 over IPv6, the packet will be sent to the virtual network card and tunnel management module for packet encapsulation. After the encapsulation is completed, the packet will be thrown back to the forwarding module and go through the packet forwarding process again. At this time, the packet is already an IPv6 packet with the source IP being the local IP and the destination IP being the tunnel far-end IP. Then continue to query the IPv6 route to determine the physical egress and the tunnel local IP of the packet. Finally, the packet is successfully sent into the IPv4 over IPv6 tunnel. If it is an encapsulated IPv6 packet with the protocol being IPIP, the forwarding module will directly send it to the virtual network card and tunnel management module for packet decapsulation after receiving it. After success, it will go through the forwarding process again to send the packet.
[0124] This application also provides a gateway device, which is applied in the IPv4 over IPv6 network scenario. The two sides of the gateway device are respectively connected to the IPv4 network and the IPv6 network. The gateway device includes: a processor and a storage medium.
[0125] Among them, the storage medium stores a computer program.
[0126] The processor is used to run the computer program, and when the computer program runs, it executes the packet forwarding method of any one of the implementation manners introduced in the above embodiments.
[0127] Through the technical solution of this application, tunnel configuration can be completed only by relying on the underlying configuration script and a small amount of configuration information (such as the identifier of the tunnel and the remote information of the tunnel). The automated configuration implementation solution reduces the complexity of configuration operations and the manual configuration cost, reduces the dependence on the professionalism of configuration personnel, effectively saves the manual configuration time, and improves the creation efficiency of the IPv4 over IPv6 tunnel and the enabling efficiency of its functions. In addition, it is beneficial to improve the quality of network services.
[0128] It should be noted that the embodiments in this specification are all described in a progressive manner. For the same or similar parts between the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple. For the relevant parts, reference can be made to the partial description of the method embodiments. The device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated, and the components described as unit tips may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0129] As described above, it is only a specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed in this application should be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
Claims
1. A packet forwarding method, characterized in that, it is applied to a gateway device in an IPv4 over IPv6 network scenario, and both sides of the gateway device are respectively connected to an IPv4 network and an IPv6 network; the method includes: responding to a tunnel configuration instruction, configuring an IPv4 over IPv6 tunnel based on page configuration information and a configuration script; wherein, the page configuration information includes identification information and remote information of the IPv4 over IPv6 tunnel, and the configuration script is a script pre-written for configuring the IPv4 over IPv6 tunnel; forwarding packets through the IPv4 over IPv6 tunnel; the configuring of the IPv4 over IPv6 tunnel based on the page configuration information and the configuration script includes: configuring the remote IPv6 address of the IPv4 over IPv6 tunnel according to the remote information; creating a virtual network card; determining the external network interface and the internal network interface configured for the gateway device according to the local interface configuration information of the gateway device; resolving the local IPv6 address of the local end according to the external network interface, and configuring the local IPv6 address for the IPv4 over IPv6 tunnel; configuring the route to send traffic accessing the remote IPv6 address to the external network interface; binding the IPv4 over IPv6 tunnel and the virtual network card; after determining the external network interface and the internal network interface configured for the gateway device according to the local interface configuration information, the method further includes: configuring the virtual network card to borrow the IPv4 address of the internal network interface.
2. The packet forwarding method according to claim 1, characterized in that, after the configuration script completes the configuration of the IPv4 over IPv6 tunnel, the method further includes: running a monitoring script, where the monitoring script is used to monitor the status information of the network; after determining the dynamic changes that occur in the network according to the monitored status information, outputting network change information, and / or adjusting the configuration information of the IPv4 over IPv6 tunnel.
3. The packet forwarding method according to claim 2, characterized in that, the status information includes at least one of the following: the local interface change information of the gateway device, the local network change information of the local end, or the remote network change information; in the case where the status information includes the local interface change information of the gateway device, the adjusted configuration information of the IPv4 over IPv6 tunnel includes: routing configuration information and / or virtual network card configuration information; in the case where the status information includes remote network change information, the adjusted configuration information of the IPv4 over IPv6 tunnel includes: the remote IPv6 address.
4. The packet forwarding method according to claim 3, characterized in that, the monitoring of the local interface change information of the gateway device includes: determining the external network interface and the internal network interface configured for the gateway device according to the local interface configuration information of the gateway device; Compare whether the actually monitored external network interface is the same as the external network interface configured for the gateway device. If they are not the same, it is determined that the external network interface has changed. Compare whether the actually monitored internal network interface is the same as the internal network interface configured for the gateway device. If they are not the same, it is determined that the internal network interface has changed. The adjusting the configuration information of the IPv4 over IPv6 tunnel includes: If the external network interface has changed, modify the routing configuration so that the traffic accessing the remote IPv6 address is sent to the newly configured external network interface. If the internal network interface has changed, configure the virtual network card to borrow the IPv4 address of the newly configured actual internal network interface.
5. The packet forwarding method according to claim 3, wherein, The monitoring the local network change information includes: When it is monitored that the IPv6 address assigned by the local public network has changed, it is determined that the local IPv6 address has changed; The outputting the network change information includes: Send a notification that the local IPv6 address has changed to the remote end of the IPv4 over IPv6 tunnel.
6. The packet forwarding method according to claim 3, wherein, The monitoring the remote network change information includes: Monitoring whether the remote IPv6 address of the IPv4 over IPv6 tunnel has changed, and / or monitoring the connectivity of the remote IPv6 address of the IPv4 over IPv6 tunnel; The outputting the network change information, and / or the adjusting the configuration information of the IPv4 over IPv6 tunnel includes: If it is monitored that the remote IPv6 address has changed, modify the remote IPv6 address configuration of the IPv4 over IPv6 tunnel; If it is monitored that the remote IPv6 address is not connected, send a log about the IPv6 network failure.
7. A gateway device, wherein, The gateway device is applied in an IPv4 over IPv6 network scenario, and both sides of the gateway device are respectively connected to an IPv4 network and an IPv6 network; The gateway device includes: a processor and a storage medium; wherein, the storage medium stores a computer program; The processor is used to run the computer program, and when the computer program runs, it executes the packet forwarding method according to any one of claims 1-6.
Citation Information
Patent Citations
Method for generating 4over6 channel dynamically
CN103825971A