A message forwarding method and device
By using the destination MAC address and inner IP address of Ethernet packets to look up the link layer address mapping table in the vehicle network, the problem of CPU resource consumption caused by ARP or ND table refresh during vehicle operation is solved, and efficient data forwarding is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NEW H3C TECH CO LTD
- Filing Date
- 2023-03-22
- Publication Date
- 2026-05-05
AI Technical Summary
In the Internet of Vehicles (IoV), frequent refreshes of the link layer address mapping table during vehicle operation lead to excessive CPU resource consumption by the gateway switch, affecting data forwarding efficiency.
By looking up the link layer address mapping table using the destination MAC address and inner IP address of the Ethernet packet, the new destination MAC address and outgoing port are obtained. The destination MAC address and VLAN of the Ethernet packet are then modified, enabling Layer 3 forwarding without refreshing ARP or ND entries.
This avoids ARP or ND table refreshes caused by vehicle movement, reduces the software computing resource consumption of the gateway switch, and improves the efficiency of data forwarding between vehicles.
Smart Images

Figure CN116436875B_ABST
Abstract
Description
Technical Field
[0001] This application relates to communication technology, particularly to vehicle-to-everything (V2X) communication technology, specifically a message forwarding method and device. Background Technology
[0002] The Internet of Vehicles (IoV) leverages next-generation information and communication technologies to achieve comprehensive network connectivity between vehicles, between vehicles and roads, between vehicles and people, and between vehicles and service platforms.
[0003] In the Internet of Vehicles (IoV), the roadside network includes wireless and wired networks. To prevent Layer 2 broadcast data packets from affecting the wired network, multiple sub-rings are set up within the wired network, and the switches in different sub-rings are configured with different VLANs. Data packets sent by vehicles and data packets sent to vehicles need to be forwarded through gateway switches.
[0004] When a vehicle communicating with other terminals (such as other vehicles or external terminals) travels from one intersection to another, or roams from one base station to another within the wireless network, the sub-ring changes. The VLAN and port of the data packets received by the gateway switch from the traveling vehicle change. The gateway switch needs to refresh the link-layer address mapping table entries (e.g., ARP entries in an IPv4 network or ND entries in an IPv6 network) to correctly reflect the port and VLAN of the traveling vehicle's data packets and guide the return data packets to be sent to the vehicle through the correct port and subnet VLAN. However, learning the link-layer address mapping table entries consumes the gateway switch's CPU resources. The frequent refreshing of the link-layer address mapping table entries by traveling vehicles within the vehicular network consumes software computing resources, leading to reduced table refresh efficiency and thus affecting data forwarding between vehicles. Summary of the Invention
[0005] The purpose of this application is to provide a message forwarding method and device to avoid the impact of link layer address mapping table refresh efficiency on the data forwarding of vehicles.
[0006] To achieve the above objectives, this application provides a packet forwarding method. In this method, Layer 3 forwarding is determined based on whether the destination MAC address of the Ethernet packet is the gateway MAC address; a link-layer address mapping table is searched based on the destination IP address of the inner IP packet of the Ethernet packet; when a link-layer address mapping table entry matching the destination IP address is found, a new destination MAC address is obtained from the matching entry; a MAC address table is searched based on the new destination MAC address; when a matching MAC address table entry matching the new destination MAC address is found, the outgoing port and outgoing VLAN are obtained from the MAC address table entry; the destination MAC address, source MAC address, and incoming VLAN of the Ethernet packet are modified to the new MAC address, gateway MAC address, and outgoing VLAN, respectively; and the modified Ethernet packet is sent through the outgoing port.
[0007] To achieve the above objectives, this application also provides a packet forwarding device, comprising: a receiving module for receiving Ethernet packets; a preprocessing module for determining Layer 3 forwarding based on the gateway MAC address, which serves as the destination MAC address of the Ethernet packet; a forwarding module for searching a link-layer address mapping table based on the destination IP address of the inner IP packet of the Ethernet packet; when a link-layer address mapping table entry matching the destination IP address is found, obtaining a new destination MAC address from the matching link-layer address mapping table entry; searching a MAC address table based on the new destination MAC address; when a matching MAC address table entry matching the new destination MAC address is found, obtaining the outgoing port and outgoing VLAN from the first MAC address table entry; modifying the destination MAC address, source MAC address, and incoming VLAN of the Ethernet packet to the new MAC address, gateway MAC address, and outgoing VLAN, respectively; and a sending module for sending the modified Ethernet packet through the outgoing port.
[0008] The beneficial effect of this application is that it changes the traditional forwarding mechanism mode, no longer obtaining the outgoing VLAN and outgoing port information of the inter-vehicle Layer 3 forwarding traffic through ARP or ND entries; thus, no matter how fast the vehicle moves, there is no need to refresh the VLAN and port of the ARP or ND entries, and the software computing resources of the gateway switch will not be occupied by refreshing a large number of ARP or ND entries, resulting in packet loss in the inter-vehicle Layer 3 traffic forwarding. Attached Figure Description
[0009] Figure 1 The flowchart of the message forwarding method embodiment provided in this application;
[0010] Figure 2 A schematic diagram illustrating the learning of link layer address table entries by a gateway switch within a vehicle network, as provided in an embodiment of this application.
[0011] Figure 3 A schematic diagram illustrating an embodiment of communication between vehicles within the same sub-ring in a vehicle network provided in this application.
[0012] Figure 4 A schematic diagram illustrating inter-vehicle communication between different sub-rings within a vehicle network provided in an embodiment of this application;
[0013] Figure 5 This is a schematic diagram of an embodiment of a message forwarding device provided in this application. Detailed Implementation
[0014] The following detailed description will be provided with reference to several examples illustrated in the accompanying figures. In this detailed description, numerous specific details are used to provide a comprehensive understanding of the present application. Known methods, steps, components, and circuits are not described in detail in the examples to avoid obscuring their meaning.
[0015] In the terminology used, the term "including" means including but not limited to; the term "containing" means including but not limited to; the terms "above," "within," and "below" include the number itself; the terms "greater than" and "less than" mean not including the number itself. The term "according to" means according to at least a part of it.
[0016] Figure 1 The diagram shown is a flowchart of an embodiment of the message forwarding method provided in this application. The method includes:
[0017] Step 101: Determine whether to perform Layer 3 forwarding based on whether the destination MAC address of the Ethernet packet is the gateway MAC address;
[0018] Step 102: Look up the link layer address mapping table based on the destination IP address of the inner IP packet of the Ethernet packet;
[0019] Step 103: When a link-layer address mapping table entry matching the destination IP address is found, obtain the new destination MAC address from the matching link-layer address mapping table entry;
[0020] Step 104: Look up the MAC address in the MAC address table based on the new destination MAC address;
[0021] Step 105: When a matching MAC address entry for the new destination MAC address is found, obtain the outgoing port and outgoing VLAN from the MAC address entry;
[0022] Step 106: Modify the destination MAC address, source MAC address, and incoming VLAN of the Ethernet packet to the new MAC address, gateway MAC address, and outgoing VLAN, respectively;
[0023] Step 107: Send the modified Ethernet packet through the output port.
[0024] Figure 1 The beneficial effect of this implementation is that it changes the traditional forwarding mechanism mode, no longer obtaining the outgoing VLAN and outgoing port information of the inter-vehicle Layer 3 forwarding traffic through ARP or ND entries; thus, no matter how fast the vehicle moves, there is no need to refresh the VLAN and port of the ARP or ND entries, and the software computing resources of the gateway switch will not be occupied by refreshing a large number of ARP or ND entries, resulting in packet loss in the inter-vehicle Layer 3 traffic forwarding.
[0025] Figure 2 This is a schematic diagram illustrating the learning of link layer address table entries by the gateway switch within the vehicle network provided in an embodiment of this application.
[0026] Figure 2In this system, the vehicle-to-everything (V2X) network consists of main rings m1 and ma2, and sub-rings s1-s4. VLANs 1 and 2 configured on sub-rings s1 and s2 belong to the virtual forwarding instance VSI1 configured on the main ring m1; VLANs 3 and 4 configured on sub-rings s3 and s4 belong to the virtual forwarding instance VSI2 configured on the main ring m2.
[0027] Vehicle V1 accesses sub-ring s1 through base station b1 and sends an ARP request packet 31 requesting the gateway MAC address of VLAN 1; wherein, the sender MAC address and sender IP address are the MAC address MAC1 and IP address IP1 of vehicle V1, respectively; the target IP address is the gateway IP address of VLAN 1.
[0028] When switch 214 receives ARP request message 31, it broadcasts it within sub-ring s1. When switch 213 receives ARP request message 31, it does not forward it through the port connected to sub-ring s2, nor does it send it through the blocked data forwarding port within sub-ring s1, i.e., the port connected to switch 212.
[0029] Switch 212 receives ARP request message 31 and sends it through the port connected to switch 203. Switch 203 of the main ring m1 receives ARP request message 31 and sends it to gateway switch 201 through the port of VSI1 of the main ring m1.
[0030] Gateway switch 201 receives ARP request packet 31 and generates an ARP entry for IP1 corresponding to MAC1, as shown in Table 1-1 below:
[0031]
[0032]
[0033] Table 1-1
[0034] Gateway switch 201 uses the MAC address entries from the received ARP request packets as shown in Table 2-1 below:
[0035] Key Item (table item) MAC1 VLAN1+PA
[0036] Table 2-1
[0037] Gateway switch 201 generates ARP response message 32; in which, the sending MAC address and sending IP address are the gateway IP address and gateway MAC address of VLAN1, respectively; the destination MAC address and IP address are MAC1 and IP1, respectively; the source MAC address is the gateway MAC address of VLAN1; and the destination MAC address is MAC1.
[0038] Gateway switch 201 finds a matching MAC address entry in the MAC address table shown in Table 2-1 based on the destination MAC address MAC1 of ARP response packet 32; obtains the outgoing port PA and outgoing VLAN (VLAN1) of ARP response packet 32; adds outgoing VLAN1 to ARP response packet 32 and sends it through outgoing port PA.
[0039] Switch 203 on the main ring m1 and switches 212 and 211 on the sub-ring s1 forward ARP response packets 32 to switch 214 based on the learned MAC address entries.
[0040] Switch 214 forwards ARP response message 32 to base station b1. Vehicle v1 receives ARP response message 32 through base station b1 and learns ARP entries based on the sender's IP address, sender's MAC address, and ingress port (i.e., the receiving port).
[0041] Figure 2 In this configuration, the gateway switch 201 does not learn ports when learning ARP entries, to avoid frequent ARP entry refreshes caused by vehicle movement, which would lead to excessive CPU resource consumption. Figure 2 In the middle, the sub-ring S1 switches 211-214 and the main network M1 switch 203 learn the MAC address table entries according to the source MAC address, incoming VLAN and incoming port of the ARP request message 31 and ARP response message 32 in the traditional mode, which will not be elaborated further.
[0042] Vehicle v2 enters sub-ring s1 and sends an ARP request packet in the same manner, requesting the MAC address of the VLAN1 gateway. Gateway switch 201 generates an ARP entry based on the ARP request packet from vehicle v2;
[0043] As shown in Table 1-2;
[0044] Key Item (table item) IP1 MAC1 IP2 MAC2
[0045] Table 1-2
[0046] Gateway switch 201 searches the MAC address table based on the received ARP request packet; if no MAC address entry matching the source MAC address MAC2 is found, it learns the MAC address table entry based on the source MAC address of the ARP request packet, the VLAN, and the receiving port, as shown in Table 2-2 below:
[0047] Key Item (table item) MAC1 VLAN1+PA MAC2 VLAN1+PA
[0048] Table 2-2
[0049] Figure 3 This is a schematic diagram illustrating an embodiment of communication between vehicles within the same sub-ring in a vehicle network provided in this application.
[0050] When vehicle v2 sends an IP datagram with destination IP address IP1 to vehicle v1, it encapsulates the IP datagram into an Ethernet packet 33 with destination MAC address being the MAC address of VLAN1 gateway; wherein the source MAC address is the MAC address MAC2 of vehicle v2.
[0051] Ethernet packet 33 sent by vehicle v2 is sent to switch s1 via base station b4, and then forwarded to gateway switch 201 via sub-ring and main ring switches 212 and 203 based on the learned VLAN 1 gateway MAC address table entry.
[0052] Gateway switch 201 determines and performs Layer 3 forwarding based on the destination MAC address of Ethernet packet 33, which is the gateway MAC address.
[0053] In this application, the gateway switch 201 checks whether the destination MAC address of the Ethernet packet is the MAC address configured for the sub-interface (i.e., the gateway MAC address of the VLAN) at the Ethernet packet receiving port and the VLAN sub-interface, and performs preprocessing on the Ethernet packet.
[0054] Gateway switch 201 looks up ARP table 1-2 based on the inner destination IP address IP1 of Ethernet packet 33; when it finds the ARP table entry that matches the destination IP address IP1, it obtains the destination MAC address MAC1 from the matching ARP table entry.
[0055] In this application, the gateway switch 201 initiates Layer 3 routing through the above preprocessing, but does not initiate Layer 3 forwarding based on the processing results of Layer 2 switching in the conventional way. That is, this application does not use the conventional method and does not initiate Layer 3 forwarding based on the destination MAC address of the Ethernet packet and the MAC address table entry with Layer 3 attributes found by VLAN.
[0056] Gateway switch 201 determines to perform Layer 2 forwarding. Based on the destination MAC address MAC1, it looks up the MAC address table 2-2 and finds a matching MAC address entry. From the MAC address table entry, it obtains the outgoing port PA and the outgoing VLAN 1. It modifies the destination MAC address of Ethernet packet 33 from the gateway MAC address of VLAN 1 to MAC1, modifies the source MAC address from MAC2 to the gateway MAC address of VLAN 1, and modifies the incoming VLAN 1 to the outgoing VLAN 1. The gateway switch then sends the modified Ethernet packet 34 through outgoing port PA.
[0057] Switches 212, 211, and 214 of the main ring 203 and the sub-ring s1 forward Ethernet packets 34 to base station b1 based on the learned MAC address entries of vehicle v1, and finally send them to vehicle v1 via base station b1.
[0058] Figure 4 This is a schematic diagram illustrating vehicle-to-vehicle communication between different sub-rings within a vehicle network, as provided in an embodiment of this application.
[0059] When vehicle v1 enters sub-ring s2, it sends an ARP request packet requesting the MAC address of VLAN2 gateway. Figure 4 (Not shown); where the sending end MAC address and sending end IP address are the MAC address MAC1 and IP1 of vehicle V1, respectively; the destination end IP address is the gateway IP address of VLAN2.
[0060] based on Figure 2 and Figure 3 The ARP request packet forwarding method shown is as follows: When gateway switch 201 receives an ARP request packet from vehicle v1, it looks up the ARP entry for IP1 that has already been learned in the ARP table shown in Table 1-2, refreshes the aging time of IP1's ARP entry, and does not refresh the content of the ARP entry. This avoids the traditional method of software learning ARP entries consuming too much CPU resources and reducing the processing efficiency of ARP protocol packets.
[0061] Gateway switch 201, based on the source MAC address MAC1 of the ARP request packet from vehicle v1, searches for a matching MAC address entry in the MAC address table shown in Table 2-2, and refreshes the incoming VLAN from VLAN1 to VLAN2; as shown in Table 2-3 below:
[0062]
[0063]
[0064] Table 2-3
[0065] The gateway switch 201 refreshes the MAC address table entries through hardware learning, which does not consume software resources.
[0066] Gateway switch 201 generates an ARP response packet to vehicle v1; in the packet, the sending MAC address and sending IP address are the gateway IP address and gateway MAC address of VLAN2, respectively; the destination MAC address and IP address are MAC1 and IP1, respectively; the source MAC address is the gateway MAC address of VLAN2; and the destination MAC address is MAC1.
[0067] Gateway switch 201 searches for a matching MAC address entry in the MAC address table shown in Table 2-3 based on the destination MAC address MAC1 of the ARP response packet; it then obtains the outgoing port PA and the outgoing VLAN (VLAN2). Gateway switch 201 adds outgoing VLAN2 to the ARP response packet and sends it through the outgoing port PA. Switch 203 on the main ring m1 and the switches on the sub-ring s2 forward the ARP response packet to switch 217 based on the learned MAC address entries.
[0068] Switch 217 forwards the ARP response message to base station b3. Vehicle v1 receives the ARP response message from gateway switch 201 through base station b3 and learns the ARP entry of the gateway of VLAN 2 based on the sender's IP address, sender's MAC address and ingress port (receiver port).
[0069] The method by which vehicle v2 requests the VLAN4 gateway IP address when entering sub-ring s4 is the same. Gateway 201 looks up the ARP entry for IP2 based on the received ARP request packet, refreshes the aging time of the ARP entry in the ARP table shown in Table 1-2, and refreshes the VLAN and port of the MAC address entry in the MAC address table shown in Table 2-3 to VLAN4 and port PB respectively, as shown in Table 2-4:
[0070] Key Item (table item) MAC1 VLAN1+PA MAC2 VLAN4+PB
[0071] Table 2-4
[0072] Ethernet packet 35 sent by vehicle v1 is sent to switch 217 via base station b3, and then forwarded to gateway switch 201 via switch 213 of sub-ring s3, and switches 212 and 203 of main ring.
[0073] Gateway switch 201 determines to perform Layer 3 forwarding based on the destination MAC address of Ethernet packet 35 being the gateway MAC address of VLAN 2. The destination IP address IP2 of Ethernet packet 35 is looked up in the ARP table shown in Table 1-2; a matching ARP entry is found, and the destination MAC address MAC2 is obtained from the matching ARP entry. Gateway switch 201 then determines to perform Layer 2 forwarding, looking up the MAC address table shown in Table 2-4 based on the destination MAC address MAC2 and finding a matching MAC address entry. It obtains the outgoing port PB and the outgoing VLAN 4; it modifies the destination MAC address of Ethernet packet 35 from the gateway MAC address of VLAN 4 to MAC2, modifies the source MAC address from MAC1 to the gateway MAC address of VLAN 4, and modifies the incoming VLAN 2 to the outgoing VLAN 4. The gateway switch sends the modified Ethernet packet 36 through outgoing port PB. Switch 202 in the main ring and the switch in the sub-ring s4 forward Ethernet packet 36 to base station b7 based on the learned MAC address entry for vehicle v2, and finally, it is sent to vehicle v2 via base station b7.
[0074] Figure 4 In this process, when vehicle v2 has not left sub-ring 4 and no traffic is sent to gateway switch 201, gateway switch 201 deletes its ARP entry from Table 1-2 when the ARP entry's aging timer expires (as shown in Table 1-1 after deletion), and deletes its MAC address entry from Table 2-4 when the MAC address entry's aging timer expires; as shown in Table 2-5:
[0075] Key Item (table item) MAC1 VLAN1+PA
[0076] Table 2-5
[0077] When the gateway switch receives an Ethernet packet from vehicle v1 or another vehicle, it determines to perform Layer 3 forwarding based on the destination MAC address, which is the gateway MAC address. If it searches the ARP table for the inner destination IP address IP2 of the Ethernet packet but does not find a matching ARP entry, it generates an ARP request packet for IP address IP2. In this packet, the sending IP address is the VLAN4 gateway IP address and the gateway MAC address; the destination IP address is IP2.
[0078] Gateway 201 generates ARP request packets through the main ring port PA of VSI1 and the main ring port PB of VSI2. The ARP request packets are sent from the main ring m1 to the sub-ring s1 on switch 212, which belongs to VSI1. The ARP request packets are broadcast within the sub-ring s1. When switch 213 receives the ARP request packets, it does not forward them through the port connected to the sub-ring s2, nor does it send them through the blocked port connected to switch 212 within the sub-ring s1.
[0079] Similarly, ARP request packets are broadcast on the main ring m1 through the sub-ring s2 port of switch 213, which belongs to VSI1. When switch 216 receives an ARP request packet, it does not send it through the port of switch 215 that is blocked in sub-ring s2, and switch 215 does not broadcast an ARP request packet to switch 216 through the blocked port.
[0080] ARP request packets are sent from the main ring m2 to the sub-ring s3 via the port of the sub-ring s3 belonging to VSI2 on switch 211; switch 211 broadcasts ARP request packets within sub-ring s3 but does not send them through the port of switch 218 that is blocked within sub-ring s3. Switch 218 receives ARP request packets but does not send them through the blocked data forwarding port within sub-ring s3, i.e., the port connected to switch 211.
[0081] ARP request packets are sent from the main ring m2 to the sub-ring s4 port belonging to VSI2 on switch 214; switch 214 broadcasts the ARP request packets within sub-ring s4 but does not send them through the port of switch 213 that is blocked within sub-ring s4; the ARP request packets are broadcast to switch 213 within the sub-ring, and switch 213 receives the ARP request packets but does not send them through the port of switch 214 that is blocked within sub-ring s4.
[0082] After receiving the ARP request message through base station b7, vehicle v2 learns the ARP table entries, generates and sends an ARP response message. The ARP response message is sent to gateway switch 201 through switches 212, 211, and 214 in sub-ring s4 and switch 202 in main ring m2.
[0083] Gateway switch 201 receives an ARP response packet from a sender with IP address IP2; it generates an ARP table entry, as shown in Table 1-2. Gateway switch 201 generates a MAC address table entry based on the source MAC address, incoming VLAN, and incoming port of the ARP response packet, as shown in Table 2-4.
[0084] Gateway switch 201 obtains the MAC address of vehicle v2 according to the ARP entries in Table 1-2; then it determines to perform Layer 2 forwarding, searches for a matching MAC address entry in the MAC address table shown in Table 2-4 based on the MAC address of vehicle v2, and obtains the outgoing port PB and outgoing VLAN (VLAN4) of vehicle v2; it modifies the source MAC address, destination MAC address, and incoming VLAN of the received Ethernet packets from vehicle v1 to the gateway MAC address, MAC2, and VLAN4 of VLAN4, respectively; it sends the modified Ethernet packets through outgoing port PB, forwarding them along the main ring m2 switch 202, and the sub-ring s4 switches 214, 211, and 212 to base station b7, which then sends the Ethernet packets to vehicle v2.
[0085] pass Figures 2-4 As shown in the embodiment, this application improves the packet forwarding mode so that changes in VLANs and data flow ports entering and leaving the switch caused by vehicle movement only refresh the Layer 2 forwarding table entries of the gateway switch, without causing a refresh of the ARP table entries in the Layer 3 forwarding module.
[0086] In the above embodiments, after the gateway switch has learned an ARP entry, it only resets the aging timer of the ARP entry when it receives an ARP protocol message, but does not refresh the entry content. This overcomes the problem in the traditional forwarding mode where the gateway switch needs to learn the ARP entry through CPU software and then synchronize it to the hardware switching module of the switching chip, which causes the CPU resources occupied by the software learning process of the ARP entry to hinder the forwarding efficiency of the gateway switch.
[0087] Based on the content disclosed in the embodiments of this application, the gateway switch implements an improved packet forwarding mechanism. It performs Layer 3 routing first and then Layer 2 switching according to preprocessing. In addition, the learning and refreshing methods of ARP entries and MAC address entries are optimized in this improved forwarding mechanism, so that forwarding failure will not be caused by the need to refresh a large number of ARP entries.
[0088] Although the above embodiments use the IPv4 network ARP protocol as an example, the embodiments of this application are also applicable to ND (Neighbor Discovery) in IPv6 networks. The gateway switch receives the NS ( N e i g hb or Solicitation messages generate ND entries that record the MAC addresses corresponding to IPv6 addresses and learn MAC addresses or update the aging time of learned ND entries, or send NS protocol messages and adjust the RA (Responsive Access Response) based on the vehicle's response. R ou t er The Advertisement message generates an ND table entry, thereby completing the mapping between IPv6 addresses and link layer MAC addresses.
[0089] Figure 5 This is a schematic diagram of an embodiment of a message forwarding device provided in this application. The device 50 includes at least a network interface, a switching chip, a CPU, and a memory. The switching chip includes at least a receiving module 51, a preprocessing module 52, a forwarding module 53, and a sending module 54. The processor executes the link-layer address mapping module 54 by running processor-executable instructions in the memory.
[0090] The receiving module 51 is used to receive Ethernet packets; the preprocessing module 52 is used to determine whether to perform Layer 3 forwarding based on the gateway MAC address, which is the destination MAC address of the Ethernet packet; the forwarding module 53 searches the link layer address mapping table based on the destination IP address of the inner IP packet of the Ethernet packet; when a first link layer address mapping table entry matching the destination IP address is found, the new destination MAC address is obtained from the matching first link layer address mapping table entry; it determines whether to perform Layer 2 forwarding and searches the MAC address table based on the new destination MAC address; when a first MAC address table entry matching the new destination MAC address is found, the outgoing port and outgoing VLAN are obtained from the first MAC address table entry; the destination MAC address, source MAC address, and incoming VLAN of the Ethernet packet are modified to the new MAC address, gateway MAC address, and outgoing VLAN, respectively; the sending module 54 sends the modified Ethernet packet through the outgoing port.
[0091] The forwarding module 53 is also used to look up the MAC address table based on the source MAC address; if no MAC address table entry matching the source MAC address is found, a second MAC address table entry is learned; wherein the source MAC address of the Ethernet packet is associated with the ingress VLAN identifier and ingress port of the Ethernet packet.
[0092] When the forwarding module 53 does not find a matching link layer address mapping table entry for the destination IP address, it notifies the link layer address mapping module 55; the link layer address mapping module 55 then generates a link layer address mapping request message for the destination IP address.
[0093] The sending module 54 sends link layer address mapping request messages through the ports of each main ring connected to the VSI within the virtual forwarding instance; wherein each main ring is associated with a different sub-ring and different sub-rings are configured with different VLANs.
[0094] The receiving module 51 is also used to receive a first link layer address mapping response message with the sender's IP address as the destination IP address; the link layer address mapping module 55 generates a first link layer address mapping table entry and synchronizes it to the link layer address mapping table of the forwarding module; the forwarding module 53 generates a first MAC address table entry; wherein, the source MAC address of the link layer address mapping response message is recorded to correspond to the ingress VLAN and ingress port of the first link layer address mapping response message.
[0095] The incoming VLAN and the outgoing VLAN belong to the same VLAN; or, the incoming VLAN and the outgoing VLAN belong to different VLANs.
[0096] The receiving module 51 is also used to receive a second link layer address mapping request message whose target IP address is the gateway IP address;
[0097] The link layer address mapping module 55 generates a second link layer address mapping table entry and synchronizes it to the link layer address mapping table of the forwarding module, and generates a second link layer address mapping response message; wherein, the second link layer address mapping table entry records the MAC address of the sender of the link layer address mapping request message corresponding to the sender IP address of the second link layer address mapping request message; or, if the second link layer address mapping table entry is found based on the sender IP address of the second link layer address mapping request message, the aging time of the table entry is refreshed.
[0098] Forwarding module 53 generates a third MAC address entry; wherein, the source MAC address of the second link layer address mapping request message in the third MAC address entry is associated with the ingress VLAN and ingress port of the second link layer address mapping request message; the third MAC address entry is found based on the destination MAC address of the second link layer address mapping response message; the egress port and egress VLAN of the second link layer address mapping response message are obtained; an egress VLAN is added to the second link layer address mapping response message; and sending module 54 sends the second link layer address mapping response message through the egress port.
[0099] In this application, the link layer address mapping request message can be an ARP request message of IPv4 protocol or an NS message of IPv6; the link layer address mapping response message can be an ARP response message or an NA message; and the link layer address mapping table entry can be an ARP entry or an ND entry.
[0100] The above are merely preferred embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A message forwarding method, characterized in that, The method includes: Based on the destination MAC address of the Ethernet packet, which is the gateway MAC address, determine whether to perform Layer 3 forwarding; The link layer address mapping table is looked up based on the destination IP address of the inner IP packet of the Ethernet packet; When a first link layer address mapping table entry matching the destination IP address is found, the new destination MAC address is obtained from the matching first link layer address mapping table entry; Look up the MAC address table based on the new destination MAC address; When a first MAC address entry matching the new destination MAC address is found, the outgoing port and outgoing VLAN are obtained from the first MAC address entry. The destination MAC address, source MAC address, and incoming VLAN of the Ethernet packet are modified to the new destination MAC address, the gateway MAC address, and the outgoing VLAN, respectively. The modified Ethernet message is sent through the output port.
2. The method according to claim 1, characterized in that, Before looking up the MAC address table based on the new destination MAC address, the method further includes: Look up the MAC address table based on the source MAC address; No matching MAC address entry was found. A second MAC address entry is then studied. The source MAC address of the Ethernet packet in the second MAC address entry is associated with the ingress VLAN identifier and ingress port of the Ethernet packet.
3. The method according to claim 1, characterized in that, The method further includes: If no matching link layer address mapping entry is found for the destination IP address, a link layer address mapping request message is generated for the destination IP address. The generated link layer address mapping request message is sent by the port of each main ring within the VSI connected to the virtual forwarding instance; wherein each main ring is associated with a different sub-ring and the different sub-rings are configured with different VLANs.
4. The method according to claim 3, characterized in that, The method further includes: Receive a first link-layer address mapping response message whose sender IP address is the destination IP address; Generate the first link layer address mapping table entry; wherein the sending IP address of the first link layer address mapping response message corresponds to the sending MAC address of the link layer address mapping response message; Generate the first MAC address table entry; wherein, the source MAC address of the link layer address mapping response message is recorded as corresponding to the ingress VLAN and ingress port of the first link layer address mapping response message.
5. The method according to claim 1 or 3, characterized in that, The incoming VLAN and the outgoing VLAN belong to the same VLAN; or, the incoming VLAN and the outgoing VLAN belong to different VLANs.
6. The method according to claim 1, characterized in that, The method further includes: Receive a second-link-layer address mapping request message whose target IP address is the gateway IP address; Generate a second link layer address mapping table entry; wherein, the second link layer address mapping table entry records the sender MAC address of the second link layer address mapping request message corresponding to the sender IP address of the second link layer address mapping request message; Generate a third MAC address entry; wherein, in the third MAC address entry, the source MAC address of the second link layer address mapping request message is associated with the ingress VLAN and ingress port of the second link layer address mapping request message; Generate a second link-layer address mapping response message; locate the third MAC address entry in the table based on the destination MAC address of the second link-layer address mapping response message; obtain the outgoing port and outgoing VLAN of the second link-layer address mapping response message; add an outgoing VLAN to the second link-layer address mapping response message and send it through the outgoing port of the second link-layer address mapping response message.
7. A message forwarding device, characterized in that, The device includes: The receiving module is used to receive Ethernet packets; The preprocessing module is used to determine whether to perform Layer 3 forwarding based on the gateway MAC address, which is the destination MAC address of the Ethernet packet. The forwarding module searches the link layer address mapping table based on the destination IP address of the inner IP packet of the Ethernet packet; when a first link layer address mapping table entry matching the destination IP address is found, it obtains the new destination MAC address from the matching first link layer address mapping table entry; it searches the MAC address table based on the new destination MAC address; when a first MAC address table entry matching the new destination MAC address is found, it obtains the outgoing port and outgoing VLAN from the first MAC address table entry; and it modifies the destination MAC address, source MAC address, and incoming VLAN of the Ethernet packet to the new destination MAC address, the gateway MAC address, and the outgoing VLAN, respectively. The sending module sends the modified Ethernet packet through the output port.
8. The device according to claim 7, characterized in that, The forwarding module is further configured to look up a MAC address in the MAC address table based on the source MAC address; if no MAC address table entry matching the source MAC address is found, a second MAC address table entry is learned; wherein the source MAC address of the Ethernet packet is associated with the ingress VLAN identifier and ingress port of the Ethernet packet.
9. The device according to claim 7, characterized in that, The device further includes: a link layer address mapping module; When the forwarding module does not find a link layer address mapping table entry that matches the destination IP address, it notifies the link layer address mapping module. The link-layer address mapping module generates a link-layer address mapping request message for the destination IP address; The sending module sends the link layer address mapping request message through the port of each main ring within the virtual forwarding instance (VSI); wherein each main ring is associated with a different sub-ring and the different sub-rings are configured with different VLANs.
10. The device according to claim 9, characterized in that, The receiving module is also configured to receive a first link layer address mapping response message whose sender IP address is the destination IP address; The link layer address mapping module generates the first link layer address mapping table entry and synchronizes it to the link layer address mapping table of the forwarding module; The forwarding module generates the first MAC address table entry; wherein, the source MAC address of the link layer address mapping response message is recorded as corresponding to the ingress VLAN and ingress port of the first link layer address mapping response message.
11. The device according to claim 7 or 9, characterized in that, The incoming VLAN and the outgoing VLAN belong to the same VLAN; or, the incoming VLAN and the outgoing VLAN belong to different VLANs.
12. The device according to claim 7, characterized in that, The receiving module is also used to receive a second link layer address mapping request message whose target IP address is the gateway IP address; The link layer address mapping module generates a second link layer address mapping table entry and synchronizes it to the link layer address mapping table of the forwarding module, and generates a second link layer address mapping response message; wherein, the second link layer address mapping table entry records the sender IP address of the second link layer address mapping request message corresponding to the sender MAC address of the link layer address mapping request message; The forwarding module generates a third MAC address entry; wherein, in the third MAC address entry, the source MAC address of the second link layer address mapping request packet is associated with the ingress VLAN and ingress port of the second link layer address mapping request packet; the third MAC address entry is found based on the destination MAC address of the second link layer address mapping response packet; the outgress port and outgress VLAN of the second link layer address mapping response packet are obtained; and an outgress VLAN is added to the second link layer address mapping response packet. The sending module sends the response message through the output port of the second link layer address mapping.
Citation Information
Patent Citations
Message transmission method and device
CN107547346A