Method and system for realizing two-layer link encryption based on routing drainage in cloud environment
By configuring a link encryption device with a micro protocol stack in the cloud environment, which is disguised as a gateway with a standard IP/MAC address, traffic guidance and link encryption are achieved by using ARP and routing forwarding mechanisms. This solves the problem of Layer 2 link encryption in the cloud environment and achieves non-intrusiveness, compatibility and deployment flexibility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING GUOLING TECH CO LTD
- Filing Date
- 2026-01-23
- Publication Date
- 2026-04-21
AI Technical Summary
In cloud computing virtualization environments, existing technologies struggle to implement Layer 2 link encryption without modifying the underlying network code of the cloud platform, and existing solutions may compromise the standardization and stability of the cloud platform.
By configuring a miniature protocol stack within the link encryption device, it disguises itself as a gateway device with a standard IP/MAC address, utilizes the cloud platform's ARP discovery and routing forwarding mechanisms to achieve traffic redirection, and performs link-layer encryption on the data plane.
It enables non-intrusive Layer 2 link encryption in the cloud environment, reducing integration risks, improving compatibility and deployment flexibility, and adapting to the needs of multi-tenant isolation and dynamic high availability.
Smart Images

Figure CN121907573A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer network security technology, and in particular to a method and system for achieving transparent encryption of Layer 2 links through a Layer 3 routing and forwarding mechanism in a cloud computing virtualization environment. Background Technology
[0002] In traditional hardware network environments, link encryption machines typically operate at Layer 2 of the OSI model (data link layer), transparent to the upper network layers, and therefore usually do not require IP address configuration. However, with the migration of business to the cloud, deploying link encryption functionality in cloud virtual machine environments (such as OpenStack, Kubernetes, etc.) faces significant challenges: 1. Traffic redirection difficulties: Traffic forwarding in cloud environments primarily relies on the Layer 3 routing functionality of virtual switches (vSwitch). Because traditional Layer 2 link encryption logic lacks IP and MAC addresses, virtual switches cannot redirect traffic through encrypted nodes using standard routing table entries. 2. Deficiencies of Existing Solutions: To address the traffic redirection issue, existing technologies typically require modifying the underlying network code of the cloud platform (such as modifying the Neutron plugin) or introducing complex SDN controllers for flow table programming. These methods are not only costly to develop and risky to deploy, but also compromise the standardization and stability of the cloud platform, making upgrades and maintenance difficult. Therefore, there is an urgent need for a cloud environment link encryption solution that does not require modification of the underlying cloud platform architecture and is compatible with mainstream virtual switch routing mechanisms. Summary of the Invention
[0003] The purpose of this invention is to provide a method for achieving Layer 2 link encryption based on routing in a cloud environment. This invention implements a miniature protocol stack within the link encryption device, making it appear as a "gateway" device with a standard IP / MAC address on the control plane. This allows it to utilize the cloud platform's existing ARP discovery and routing mechanisms to redirect traffic; while on the data plane, the device maintains its Layer 2 transparent encryption characteristics. The core technical solution of this invention is as follows: A method for implementing Layer 2 link encryption based on routing in a cloud environment, characterized in that the method includes the following steps: S1. Deployment steps: Deploy at least one link encryption device in the cloud environment. The link encryption device is configured with at least one internal network interface (LAN) and one external network interface (WAN), and runs a micro network protocol stack. S2. Misleading and Guiding Step: The link encryption device configures a virtual IP address and a virtual MAC address through the micro network protocol stack, receives an Address Resolution Protocol (ARP) request from the Layer 3 virtual switch, and sends an ARP response, causing the Layer 3 virtual switch to update its ARP cache table and direct the next hop of the target traffic to the link encryption device. S3. Routing and forwarding steps: The Layer 3 virtual switch forwards the original data packets sent by the cloud virtual machine to the intranet interface of the link encryption device according to the preset routing rules; S4. Encryption Processing Step: After receiving the original data packet, the link encryption device performs link-layer encryption processing on it to generate a ciphertext data packet; S5. Transparent transmission step: The link encryption device sends the encrypted data packet to the peer network device or the next-hop node through the external network interface. The beneficial effects of this invention are as follows: 1. Zero intrusion: It does not require modification of the underlying network code of cloud platforms (such as OpenStack / K8s) and can work using standard routing protocols, significantly reducing integration risks. 2. Strong compatibility: Suitable for various virtualization environments that support custom routing, without relying on a specific SDN controller brand. 3. Flexible deployment: Supports virtual machine or containerized deployment, multi-tenant isolation and dynamic high availability switching, adapting to the elasticity requirements of cloud environments. Attached Figure Description Figure 1 This is a schematic diagram of the data flow for implementing Layer 2 link encryption based on routing in a cloud environment, as described in this invention. Figure 2 This is a schematic diagram illustrating the data flow of the present invention in a cloud environment, which implements Layer 2 link encryption based on routing and redirection and then flows back to the virtual Layer 3 device. Detailed Implementation The technical solution of the present invention will be further described below with reference to the accompanying drawings and specific embodiments. Example 1: Straight-through mode Figure 1 As shown in the figure, this embodiment describes a scenario where the encrypted data is directly sent to the peer device. 1. Initialization phase: The link encryption system starts the micro protocol stack and configures the virtual IP (e.g., 192.168.1.254) and virtual MAC. 2. Routing configuration: Configure routing rules in the network controller of the cloud platform to point the next hop of the destination network segment (e.g., 10.0.0.0 / 8) to the virtual IP. 3. ARP Induction: The Layer 3 virtual switch initiates an ARP request to inquire "who is 192.168.1.254?" The link encryption system replies with its own virtual MAC address via a miniature protocol stack. The switch then updates its ARP table. 4. Data flow: a. Cloud virtual machine sends data packets -> Layer 3 virtual switch looks up the table -> routing rule is hit -> forwards to the LAN port of the link encryption system. b. Key step: The link encryption system captures the message. Although the message is destined for the next hop, the encryption system intercepts it at Layer 2 and encrypts the payload using a built-in encryption module (such as SM4). c. The encrypted message is sent directly to the peer physical network device through the WAN port. Example 2: Reflow mode as follows Figure 2 As shown in the figure, this embodiment describes a scenario where encrypted data needs to be sent back to a virtual switch for secondary forwarding. The main difference lies in step (i): the link encryption system re-injects the encrypted message into a Layer 3 virtual switch (or another independent virtual network) through the WAN port, and the switch forwards it to the remote end according to the outer tunnel encapsulation or new routing rules. This is suitable for encrypted transmission scenarios across VPCs or across clouds.
Claims
1. A method for implementing Layer 2 link encryption based on routing in a cloud environment, characterized in that, The method includes the following steps: S1. Deployment steps: Deploy at least one link encryption device in the cloud environment. The link encryption device is configured with at least one internal network interface (LAN) and one external network interface (WAN), and runs a micro network protocol stack. S2. Misleading and Guiding Step: The link encryption device configures a virtual IP address and a virtual MAC address through the micro network protocol stack, receives an Address Resolution Protocol (ARP) request from the Layer 3 virtual switch, and sends an ARP response, causing the Layer 3 virtual switch to update its ARP cache table and direct the next hop of the target traffic to the link encryption device. S3. Routing and forwarding steps: The Layer 3 virtual switch forwards the original data packets sent by the cloud virtual machine to the intranet interface of the link encryption device according to the preset routing rules; S4. Encryption Processing Step: After receiving the original data packet, the link encryption device performs link-layer encryption processing on it to generate a ciphertext data packet; S5. Transparent transmission step: The link encryption device sends the encrypted data packet to the peer network device or the next-hop node through the external network interface.
2. The method according to claim 1, characterized in that, The micro network protocol stack contains only functional modules for processing ARP and ICMP protocols, used to establish network connectivity identifiers. The virtual IP address and virtual MAC address are only used for traffic guidance and do not participate in the logical addressing of encrypted service data.
3. The method according to claim 1, characterized in that, The link encryption device is deployed as a virtual machine (VM) instance or a container instance; the method also includes running multiple instances of the link encryption device in parallel on a single physical host, each instance corresponding to a different tenant or security domain, to achieve multi-tenant isolated link encryption service.
4. The method according to claim 1, characterized in that, The method also includes a high availability guarantee step: the link encryption device supports dynamic updating of the virtual IP address and virtual MAC address, and notifies the Layer 3 virtual switch to update the ARP cache by actively sending gratuitous ARP messages, so as to achieve fault switching or load balancing of the link encryption service.
5. The method according to claim 1, characterized in that, In the transparent transmission step, the transmission target of the external network interface includes one of the following two modes: (1) Mode 1: Direct physical pass-through to the peer physical network device; (2) Mode 2: The data is sent back to the Layer 3 virtual switch, which then forwards it to the other end according to the routing rules.
6. A system for implementing Layer 2 link encryption based on routing in a cloud environment, characterized in that, include: (1) Cloud virtual machine, used to generate raw business data packets; (2) A Layer 3 virtual switch is used to configure routing rules, send ARP requests, update the cache table according to the ARP response, and route the original service data packets to the next hop; (3) Link encryption device, connected to the Layer 3 virtual switch, is configured to: initialize virtual IP address and virtual MAC address; run micro protocol stack to respond to ARP request from the Layer 3 virtual switch; receive the original data packet and perform link layer encryption; and send the encrypted data packet through the external network interface.