CN109768909B - Message forwarding method and device - Google Patents

Message forwarding method and device Download PDF

Info

Publication number
CN109768909B
CN109768909B CN201910232434.7A CN201910232434A CN109768909B CN 109768909 B CN109768909 B CN 109768909B CN 201910232434 A CN201910232434 A CN 201910232434A CN 109768909 B CN109768909 B CN 109768909B
Authority
CN
China
Prior art keywords
vlan
mapping
message
forwarding
modified
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910232434.7A
Other languages
Chinese (zh)
Other versions
CN109768909A (en
Inventor
周立伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN201910232434.7A priority Critical patent/CN109768909B/en
Publication of CN109768909A publication Critical patent/CN109768909A/en
Application granted granted Critical
Publication of CN109768909B publication Critical patent/CN109768909B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a message forwarding method and a device, wherein the method comprises the following steps: when a data message is received, determining a mapping VLAN identifier of the data message according to an input interface of the received data message; modifying the current VLAN identification carried by the data message into the mapping VALN identification; searching a forwarding table item hit by the modified message; wherein, the forwarding table entry corresponds to the mapping VLAN identification; and revising the mapping VLAN identification carried by the revised message into the current VLAN identification, and forwarding the revised message based on the forwarding table entry. According to the technical scheme, the physical equipment of which the hardware resources do not support the equipment virtualization technology can be virtualized into a plurality of logical equipment.

Description

Message forwarding method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for forwarding a packet.
Background
With the continuous development of information technology, the network scale is enlarged and the networking structure is complicated. In order to simplify the networking structure, integrate the physical devices, and improve the utilization rate of the device resources, a device virtualization technology that virtualizes one physical device into multiple logical devices may be generally used.
In the device virtualization technology, each virtualized logic device has independent hardware and software resources, and can independently maintain forwarding table entries. On the other hand, each logic device is independently managed through an independent administrator, a log management mechanism and the like, namely, the operation of each logic device virtualized in the same physical device is not influenced mutually.
However, in practical applications, in order to implement the device virtualization technology, hardware resources (e.g., a switch chip in a switch, etc.) in the physical device are generally required to support the device virtualization technology, and for a physical device whose hardware resources do not support the device virtualization technology, the physical device cannot be virtualized into multiple logical devices.
Disclosure of Invention
In view of this, the present application provides a message forwarding method and apparatus, so as to solve the problem that a physical device whose hardware resources do not support the device virtualization technology cannot be virtualized into multiple logical devices in the related art.
Specifically, the method is realized through the following technical scheme:
in a first aspect, the present application provides a method for forwarding a packet, where the method includes:
when a data message is received, determining a mapping VLAN identifier of the data message according to an input interface of the received data message;
modifying the current VLAN identification carried by the data message into the mapping VALN identification;
searching a forwarding table item hit by the modified message; wherein, the forwarding table entry corresponds to the mapping VLAN identification;
and revising the mapping VLAN identification carried by the revised message into the current VLAN identification, and forwarding the revised message based on the forwarding table entry.
In a second aspect, the present application provides a packet forwarding apparatus, including:
the first determining unit is used for determining the mapping VLAN identification of the data message according to the input interface of the received data message when the data message is received;
a first modification unit, configured to modify a current VLAN identifier carried in the data packet into the mapped VLAN identifier;
the searching unit is used for searching the forwarding table item hit by the modified message; wherein, the forwarding table entry corresponds to the mapping VLAN identification;
and the second modification unit is used for modifying the mapping VLAN identification carried by the modified message into the current VLAN identification again and forwarding the modified message based on the forwarding table entry.
By analyzing the above technical solution, for each virtualized logical device in the physical device, the VLAN identifier carried in the packet received through the physical interface allocated to the logical device may be modified into a corresponding mapped VLAN identifier, and a forwarding table entry hit by the packet is determined according to the mapped VLAN identifier, so as to forward the packet according to the forwarding table entry. By adopting the method, when the hardware resources in the physical device do not support the device virtualization technology, the forwarding table entries maintained by each logic device virtualized in the physical device can still be ensured to be independent from each other, and the operation of each logic device can not be influenced mutually, that is, the physical device of which the hardware resources do not support the device virtualization technology is virtualized into a plurality of logic devices.
Drawings
Fig. 1 is a flowchart illustrating a message forwarding method according to an exemplary embodiment of the present application;
fig. 2 is a flowchart illustrating another message forwarding method according to an exemplary embodiment of the present application;
fig. 3 is a flowchart illustrating another message forwarding method according to an exemplary embodiment of the present application;
fig. 4 is a hardware structure diagram of a device where a message forwarding apparatus is located according to an exemplary embodiment of the present application;
fig. 5 is a block diagram of a message forwarding apparatus according to an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
In practical applications, in order to implement the device virtualization technology, hardware resources (e.g., a switch chip in a switch, etc.) in a physical device are generally required to support the device virtualization technology, and for a physical device whose hardware resources do not support the device virtualization technology, the physical device cannot be virtualized into multiple logical devices.
In order to simplify a networking structure, integrate physical equipment, improve the utilization rate of equipment resources and reduce equipment cost, the application provides a message forwarding method and a message forwarding device, so that the physical equipment of which hardware resources do not support an equipment virtualization technology is virtualized into a plurality of logical equipment.
Referring to fig. 1, a flowchart of a message forwarding method according to an exemplary embodiment of the present application is shown. The method can be applied to physical equipment such as a switch and the like, and comprises the following steps:
step 101: and when a data message is received, determining the mapping VLAN identification of the data message according to the input interface of the received data message.
Step 102: and modifying the current VLAN identification carried by the data message into the mapping VALN identification.
Step 103: searching a forwarding table item hit by the modified message; wherein, the forwarding table entry corresponds to the mapping VLAN identification.
Step 104: and revising the mapping VLAN identification carried by the revised message into the current VLAN identification, and forwarding the revised message based on the forwarding table entry.
In this embodiment, the same physical device may be virtualized into multiple logical devices, that is, multiple virtual logical devices may be created in the same actual physical device, and forwarding related parameters may be configured for each logical device.
Taking a switch as an example, multiple logical switches may be created in the same physical switch, and a physical interface may be allocated to each logical switch.
Subsequently, when the physical device receives a data packet sent by another physical device, the physical device may determine a mapping VLAN (Virtual Local Area Network) identifier of the data packet according to a physical interface (i.e., an input interface) that receives the data packet.
Specifically, while allocating a physical interface to each logical device virtualized in the physical device, a start VLAN id may be set for each logical device. Subsequently, when the physical device receives a data packet sent by another physical device, the physical device may determine the mapping VLAN id of the data packet according to the VLAN id of the VLAN to which the ingress interface receiving the data packet belongs and the initial VLAN id of the logical device to which the ingress interface belongs.
Or, when a physical interface is allocated to each logical device virtualized in the physical device, a mapping VLAN identifier may also be set for a VLAN to which each physical interface belongs. Subsequently, when the physical device receives a data packet sent by another physical device, the mapping VLAN id of the data packet may be determined directly according to the VLAN to which the ingress interface receiving the data packet belongs.
After determining the mapping VLAN id of the data packet, the physical device may modify the VLAN id (referred to as a current VLAN id, which is usually the VLAN id of the VLAN to which the ingress interface receiving the data packet belongs) carried by the data packet into the mapping VLAN id.
Subsequently, the physical device may search for a forwarding entry hit by the modified packet in the forwarding entry corresponding to the mapping VLAN id.
After finding the forwarding table item hit by the modified message, the physical device may modify the mapping VLAN id carried by the modified message into the current VLAN id again. Subsequently, the physical device may forward the re-modified packet based on the found forwarding entry, that is, may forward the received original data packet based on the found forwarding entry.
For example, if a physical interface 1 is assigned to a virtualized logical switch 1 in a physical switch, and the physical interface 1 belongs to a VLAN N, and further if a starting VLAN id set for the logical switch 1 is a VLAN M, the physical switch may generate an ingress direction VLAN mapping rule and an egress direction VLAN mapping rule, and store the ingress direction VLAN mapping rule and the egress direction VLAN mapping rule in a switch chip of the physical switch; the inbound VLAN mapping rule is that the VLAN id of the data packet received through the physical interface 1 is mapped from VLAN N to VLAN N + M, and correspondingly, the outbound VLAN mapping rule is that the VLAN id of the data packet with VLAN id VLANN + M is mapped from VLAN N + M to VLAN N.
Subsequently, when the physical switch receives a data packet sent by another physical device through the physical interface 1 based on the switch chip of the physical switch, the mapping VLAN identifier of the data packet may be determined to be VLAN + M according to the incoming direction VLAN mapping rule and the physical interface 1 (i.e., the incoming interface) that receives the data packet.
After determining that the mapping VLAN id of the data packet is VLAN N + M, the VLAN N (i.e., the current VLAN id) carried by the data packet may be modified to VLAN N + M (i.e., the mapping VLAN id).
Subsequently, the physical device may search for a forwarding entry hit by the modified packet from the forwarding entries corresponding to the VLAN N + M.
After finding the forwarding table item hit by the modified message, the physical device may modify the VLAN N + M carried by the modified message into VLAN N again. Subsequently, the physical device may forward the re-modified packet based on the found forwarding entry, that is, forward the packet carrying the VLAN N based on the found forwarding entry.
It should be noted that, for different physical interfaces belonging to the same VLAN, the physical interfaces may be assigned to different logical devices, that is, mapping VLAN identifiers corresponding to the physical interfaces may be different.
For example, if a physical interface 1 is assigned to a logical switch 1 virtualized in a physical switch, a physical interface 2 and a physical interface 3 are assigned to a logical switch 2 virtualized in the physical switch, and the physical interface 1, the physical interface 2 and the physical interface 3 all belong to VLAN N, and further if a starting VLAN id set for the logical switch 1 is VLAN M and a starting VLAN id set for the logical switch 2 is VLAN L, the physical switch may generate an ingress direction VLAN mapping rule and an egress direction VLAN mapping rule, and store the ingress direction VLAN mapping rule and the egress direction VLAN mapping rule in a switch chip of the physical switch; on one hand, the inbound direction VLAN mapping rule includes that a VLAN identifier of a data packet received through the physical interface 1 is mapped from VLAN N to VLAN N + M, and correspondingly, the outbound direction VLAN mapping rule includes that a VLAN identifier of a data packet with a VLAN identifier of VLAN N + M is mapped from VLAN N + M to VLAN N; on the other hand, the inbound VLAN mapping rule includes mapping the VLAN id of the data packet received through the physical interface 2 or the physical interface 3 from VLAN N to VLAN N + L, and correspondingly, the outbound VLAN mapping rule includes mapping the VLAN id of the data packet with VLAN id VLAN N + L from VLAN N + L to VLAN N.
In an optional embodiment, the data packet received by the physical device may be a layer two packet, and at this time, the physical device may perform layer two forwarding on the layer two packet. Referring to fig. 2, a flowchart of another packet forwarding method according to an exemplary embodiment of the present application is shown. The method can be applied to physical equipment such as a switch and the like, and comprises the following steps:
step 201: and when a two-layer message is received, determining the mapping VLAN identification of the two-layer message according to the input interface of the received two-layer message.
Step 202: and modifying the current VLAN identification carried by the two-layer message into the mapping VALN identification.
Step 203: and searching an MAC forwarding table item hit by the modified message in a local MAC forwarding table according to the target MAC address carried by the modified message and the mapping VLAN identification.
Step 204: and revising the mapping VLAN identification carried by the revised message into the current VLAN identification, and forwarding the revised message based on the MAC forwarding table entry.
Referring to the foregoing steps 101 and 102, when receiving a two-layer packet, a physical device may determine a mapping VLAN id of the two-layer packet according to an ingress interface that receives the two-layer packet, so that a current VLAN id carried by the two-layer packet may be modified to the mapping VLAN id.
Subsequently, the physical device may find, in a local MAC (Medium/Media Access Control) forwarding table, an MAC forwarding table entry hit by the modified message according to a destination MAC address and a VLAN identifier (i.e., the mapping VLAN identifier) carried by the modified message.
After finding the MAC forwarding entry hit by the modified packet, the physical device may modify the mapping VLAN id carried by the modified packet into the current VLAN id again. Subsequently, the physical device may forward the re-modified packet based on the found MAC forwarding entry, that is, may perform two-layer forwarding on the received original two-layer packet based on the found MAC forwarding entry.
For example, the physical device may store a MAC forwarding table as shown in table 1 below:
MAC address VLAN Interface
MAC Address 1 VLAN N+M Physical interface 2
…… …… ……
TABLE 1
Assuming that the physical device determines that the mapping VLAN id of the two-layer packet is VLAN N + M according to the physical interface 1 (i.e., the incoming interface that receives the two-layer packet) when receiving the two-layer packet with the VLAN id being VLAN N through the physical interface 1, the VLAN N carried by the two-layer packet may be modified to VLAN N + M.
Further assuming that the destination MAC address carried by the two-layer packet is MAC address 1, the physical device may search, in the MAC forwarding table shown in table 1, an MAC forwarding table entry hit by the modified packet according to VLAN N + M and MAC address 1.
Subsequently, the physical device may modify the VLAN N + M carried by the modified packet into the VLAN N again, and forward the re-modified packet based on the found MAC forwarding entry, that is, perform two-layer forwarding on the two-layer packet carrying the VLAN N through the physical interface 2.
It should be noted that, on one hand, if the MAC forwarding table entry hit by the modified packet is not found in the local MAC forwarding table, the physical device may perform packet flooding based on the modified packet after the mapping VLAN id carried by the modified packet is modified to the current VLAN id again.
On the other hand, after determining the mapping VLAN id of the two-layer packet according to the ingress interface of the received two-layer packet and modifying the current VLAN id carried by the two-layer packet to the mapping VLAN id, the physical device may update the local MAC forwarding table according to the ingress interface of the modified packet (i.e., the ingress interface of the two-layer packet), the source MAC address carried by the modified packet (i.e., the source MAC address carried by the two-layer packet), and the VLAN id carried by the modified packet (i.e., the mapping VLAN id).
For example, if the physical device determines that the mapping VLAN id of the two-layer packet is VLAN N + M according to the physical interface 1 (i.e., the ingress interface that receives the two-layer packet) when receiving the two-layer packet with the VLAN id being VLAN N through the physical interface 1, the VLAN N carried by the two-layer packet may be modified to VLAN N + M.
Further assuming that the source MAC address carried in the two-layer packet is MAC address 2, the physical device may update the local MAC forwarding table to the following table 2:
MAC address VLAN Interface
MAC Address 2 VLAN N+M Physical interface 1
…… …… ……
TABLE 2
In another optional embodiment, the data packet received by the physical device may be a three-layer packet, and at this time, the physical device may forward the three-layer packet by three layers. Referring to fig. 3, a flowchart of another message forwarding method according to an exemplary embodiment of the present application is shown. The method can be applied to physical equipment such as a switch and the like, and comprises the following steps:
step 301: and when a three-layer message is received, determining the mapping VLAN identification of the three-layer message according to an input interface of the received three-layer message.
Step 302: modifying the current VLAN identification carried by the three-layer message into the mapping VALN
Step 303: and searching an IP forwarding table item hit by the modified message in a local IP forwarding table according to a target IP address carried by the modified message and the VRF identifier corresponding to the mapping VLAN identifier.
Step 304: in a local ARP table, searching an ARP table item hit by the modified message according to a next hop IP address in the IP forwarding table item; and the VLAN identification in the ARP table entry is the current VLAN identification.
Step 305: based on the ARP table entry, the mapping VLAN identification carried by the modified message is modified into the current VLAN identification again, and the source MAC address and the destination MAC address carried by the modified message are modified again.
Step 306: and forwarding the message after being modified again based on the IP forwarding table entry.
Referring to the foregoing steps 101 and 102, when receiving a three-layer packet, a physical device may determine, according to an ingress interface that receives the three-layer packet, a mapping VLAN id of the three-layer packet, so that a current VLAN id carried by the three-layer packet may be modified to the mapping VLAN id.
It should be noted that, a corresponding VRF (virtual routing Forwarding, VPN routing Forwarding table) identifier may also be set for each mapping VLAN identifier, that is, the VLAN represented by the mapping VLAN identifier is divided into VRFs represented by the corresponding VRF identifiers.
Subsequently, the physical device may search, in the local IP forwarding table, an IP forwarding table entry hit by the modified packet according to the destination IP address carried by the modified packet and the VRF identifier corresponding to the mapping VLAN identifier.
After finding out the IP forwarding entry hit by the modified message, the physical device may further find out, in a local ARP (Address Resolution Protocol), the ARP entry hit by the modified message according to the next-hop IP Address in the found IP forwarding entry; and the VLAN identification in the ARP table entry is the current VLAN identification.
In this way, the physical device may modify the mapping VLAN id carried in the modified packet to the current VLAN id again based on the found ARP entry, and modify the source MAC address and the destination MAC address carried in the modified packet again.
Subsequently, the physical device may forward the message after being modified again based on the found IP forwarding entry, that is, after modifying the source MAC address and the destination MAC address carried in the received original three-layer message, the physical device may perform three-layer forwarding on the modified three-layer message based on the found IP forwarding entry.
For example, the physical device may store therein an IP forwarding table as shown in table 3 below:
destination IP address VRF Next hop IP address Interface
IP address 1 VRF 1 IP address 2 Physical interface 3
…… …… …… ……
TABLE 3
Assuming that the physical device determines that the mapping VLAN identifier of the three-layer packet is VLAN X + Y according to the physical interface 4 (i.e., the incoming interface that receives the three-layer packet) when receiving the three-layer packet with the VLAN identifier of VLAN X through the physical interface 4, the VLAN X carried by the three-layer packet may be modified to VLAN X + Y.
Further assuming that VLAN X + Y is divided into VRF 1, it can be determined that the VRF corresponding to VLAN X + Y is identified as VRF 1.
Further assuming that the destination IP address carried by the three-layer packet is IP address 1, the physical device may search, in the IP forwarding table shown in table 3, an IP forwarding table entry hit by the modified packet according to VRF 1 and IP address 1.
Subsequently, the physical device may search for an ARP entry hit by the modified packet in the local ARP table according to the IP address 2. The physical device may store therein an ARP table as shown in table 4 below:
IP address MAC address VLAN
IP address 2 MAC Address 3 VLAN X
…… …… ……
TABLE 4
Thus, the physical device can revise the VLAN X + Y carried by the revised message to VLAN X again, and can revise the revised message again, that is, revise the destination MAC address of the revised message to MAC address 3 again, and revise the source MAC address of the revised message to the MAC address of the device again.
Subsequently, the physical device may forward the message after being modified again based on the found IP forwarding entry, that is, forward three layers of messages carrying the VLAN X and having the source MAC address as the MAC address of the device and the destination MAC address as the MAC address 3 through the physical interface 3.
It should be noted that, after determining the mapping VLAN id of the ARP request packet according to the ingress interface that receives the ARP request packet and modifying the current VLAN id carried by the ARP request packet into the mapping VLAN id, the physical device may learn the corresponding ARP entry according to the source IP address and the source MAC address carried by the modified ARP request packet, and set the VLAN id in the ARP entry as the current VLAN id to update the local ARP table. Subsequently, the physical device may construct an ARP reply message according to the current VLAN identifier and return the ARP reply message.
For example, assuming that when the physical device receives an ARP request packet with a VLAN id of VLAN X through the physical interface 3, it determines that the mapping VLAN id of the ARP request packet is VLAN X + Y according to the physical interface 3 (i.e., the incoming interface that receives the ARP request packet), the VLAN X carried by the ARP request packet may be modified to VLAN X + Y.
Further assuming that the source IP address carried by the ARP request message is IP address 3, and the source MAC address carried by the ARP request message is MAC address 4, the physical device may update the local MAC forwarding table to the following table 5:
IP address MAC address VLAN
IP address 3 MAC Address 4 VLAN X
…… …… ……
TABLE 5
Subsequently, the physical device may construct and return an ARP reply message carrying VLAN X.
By analyzing the above technical solution, for each virtualized logical device in the physical device, the VLAN identifier carried in the packet received through the physical interface allocated to the logical device may be modified into a corresponding mapped VLAN identifier, and a forwarding table entry hit by the packet is determined according to the mapped VLAN identifier, so as to forward the packet according to the forwarding table entry. By adopting the method, when the hardware resources in the physical device do not support the device virtualization technology, the forwarding table entries maintained by each logic device virtualized in the physical device can still be ensured to be independent from each other, and the operation of each logic device can not be influenced mutually, that is, the physical device of which the hardware resources do not support the device virtualization technology is virtualized into a plurality of logic devices.
Corresponding to the embodiment of the message forwarding method, the application also provides an embodiment of a message forwarding device.
The embodiment of the message forwarding device can be applied to physical equipment such as a switch. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. The software implementation is taken as an example, and is formed by reading corresponding computer program instructions in the nonvolatile memory into the memory for operation through the processor of the device where the software implementation is located as a logical means. In terms of hardware, as shown in fig. 4, the switch in which the message forwarding apparatus is located in the present application is a hardware structure diagram, except for the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 4, the switch in which the apparatus is located in the embodiment may also include other hardware according to the actual function of the message forwarding, which is not described again.
Referring to fig. 5, a block diagram of a message forwarding apparatus according to an exemplary embodiment of the present application is shown. The apparatus 500 may be applied to the switch shown in fig. 4, and includes:
a first determining unit 501, configured to determine, when a data packet is received, a mapping VLAN identifier of the data packet according to an ingress interface that receives the data packet;
a first modifying unit 502, configured to modify a current VLAN identifier carried in the data packet into the mapping VLAN identifier;
a searching unit 503, configured to search a forwarding table entry hit by the modified message; wherein, the forwarding table entry corresponds to the mapping VLAN identification;
a second modifying unit 504, configured to modify the mapping VLAN id carried in the modified packet into the current VLAN id again, and forward the modified packet based on the forwarding table entry.
In an optional embodiment, when the data packet is a two-layer packet, the searching unit 503 may specifically be configured to:
in a local MAC forwarding table, searching an MAC forwarding table item hit by the modified message according to a target MAC address carried by the modified message and the mapping VLAN identification;
the second modifying unit 504 may specifically be configured to:
and revising the mapping VLAN identification carried by the revised message into the current VLAN identification, and forwarding the revised message based on the MAC forwarding table entry.
In an optional embodiment, the apparatus 500 may further include:
a first updating unit 505, configured to update a local MAC address table according to the ingress interface of the modified packet, and the source MAC address and the mapping VLAN identifier carried in the modified packet.
In an optional embodiment, when the data packet is a three-layer packet, the searching unit 503 may be specifically configured to:
in a local IP forwarding table, searching an IP forwarding table item hit by the modified message according to a target IP address carried by the modified message and a VRF identifier corresponding to the mapping VLAN identifier;
in a local ARP table, searching an ARP table item hit by the modified message according to a next hop IP address in the IP forwarding table item; wherein, the VLAN identification in the ARP list item is the current VLAN identification;
the second modifying unit 504 may specifically be configured to:
based on the ARP table entry, the mapping VLAN identification carried by the modified message is modified into the current VLAN identification again, and the source MAC address and the target MAC address carried by the modified message are modified again;
and forwarding the message after being modified again based on the IP forwarding table entry.
In an optional embodiment, the apparatus 500 may further include:
a second determining unit 506, configured to determine, when receiving the ARP request packet, a mapping VLAN id of the data packet according to an ingress interface that receives the ARP request packet;
a second updating unit 507, configured to update a local ARP table according to the source MAC address and the source IP address carried in the ARP request packet, and the mapping VLAN identifier;
and a constructing unit 508, configured to construct an ARP reply message according to the current VLAN identifier carried in the ARP request message, and return the ARP reply message.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (10)

1. A message forwarding method is applied to a switch and is characterized in that the switch comprises a plurality of virtual logic switches, and each logic switch corresponds to a different forwarding table; the method comprises the following steps:
when a data message is received, determining a mapping VLAN identification corresponding to an incoming interface of the received data message according to a preset VLAN mapping rule, wherein the preset VLAN mapping rule comprises a corresponding relation between the incoming interface and the mapping VLAN identification, and each logic switch corresponds to different mapping VLAN identifications respectively;
modifying the current VLAN identification carried by the data message into the mapping VLAN identification;
in a forwarding table of a logic switch corresponding to the mapping VLAN identification, searching a forwarding table item hit by the modified message according to the mapping VLAN identification; wherein, the forwarding table entry corresponds to the mapping VLAN identification;
and revising the mapping VLAN identification carried by the revised message into the current VLAN identification, and forwarding the revised message based on the forwarding table entry.
2. The method of claim 1, wherein when the data packet is a two-layer packet, the searching for a forwarding entry hit by the modified packet according to the mapping VLAN id in a forwarding table of a logical switch corresponding to the mapping VLAN id comprises:
in a local MAC forwarding table of a logic switch corresponding to the mapping VLAN identification, searching an MAC forwarding table item hit by the modified message according to a target MAC address carried by the modified message and the mapping VLAN identification;
the step of revising the mapping VLAN identification carried by the revised message into the current VLAN identification and forwarding the revised message based on the forwarding table entry comprises the following steps:
and revising the mapping VLAN identification carried by the revised message into the current VLAN identification, and forwarding the revised message based on the MAC forwarding table entry.
3. The method of claim 2, further comprising:
and updating a local MAC address table of the logic switch corresponding to the mapping VLAN identification according to the modified message input interface, the source MAC address carried by the modified message and the mapping VLAN identification.
4. The method of claim 1, wherein when the data packet is a three-layer packet, the searching for a forwarding entry hit by the modified packet according to the mapping VLAN id in a forwarding table of a logical switch corresponding to the mapping VLAN id comprises:
in a local IP forwarding table of the logic switch corresponding to the mapping VLAN identification, searching an IP forwarding table item hit by the modified message according to a destination IP address carried by the modified message and the VRF identification corresponding to the mapping VLAN identification;
in a local ARP table of a logic switch corresponding to the mapping VLAN identification, searching an ARP table item hit by the modified message according to a next hop IP address in the IP forwarding table item; wherein, the VLAN identification in the ARP list item is the current VLAN identification;
the step of revising the mapping VLAN identification carried by the revised message into the current VLAN identification and forwarding the revised message based on the forwarding table entry comprises the following steps:
based on the ARP table entry, the mapping VLAN identification carried by the modified message is modified into the current VLAN identification again, and the source MAC address and the target MAC address carried by the modified message are modified again;
and forwarding the message after being modified again based on the IP forwarding table entry.
5. The method of claim 4, further comprising:
when an ARP request message is received, determining a mapping VLAN identifier corresponding to an input interface receiving the ARP request message according to the preset VLAN mapping rule;
updating a local ARP table of the logic switch corresponding to the mapping VLAN identification according to the source MAC address and the source IP address carried by the ARP request message and the mapping VLAN identification;
and constructing an ARP response message according to the current VLAN identification carried by the ARP request message and returning the ARP response message.
6. A message forwarding device is applied to a switch and is characterized in that the switch comprises a plurality of virtual logic switches, and each logic switch corresponds to a different forwarding table; the device comprises:
the device comprises a first determining unit, a second determining unit and a third determining unit, wherein the first determining unit is used for determining a mapping VLAN identifier corresponding to an incoming interface of a received data message according to a preset VLAN mapping rule when the data message is received, the preset VLAN mapping rule comprises a corresponding relation between the incoming interface and the mapping VLAN identifier, and each logic switch corresponds to different mapping VLAN identifiers respectively;
a first modification unit, configured to modify a current VLAN identifier carried in the data packet into the mapping VLAN identifier;
a searching unit, configured to search, in a forwarding table of the logical switch corresponding to the mapping VLAN identifier, a forwarding table entry hit by the modified message according to the mapping VLAN identifier; wherein, the forwarding table entry corresponds to the mapping VLAN identification;
and the second modification unit is used for modifying the mapping VLAN identification carried by the modified message into the current VLAN identification again and forwarding the modified message based on the forwarding table entry.
7. The apparatus according to claim 6, wherein when the data packet is a two-layer packet, the searching unit is specifically configured to:
in a local MAC forwarding table of a logic switch corresponding to the mapping VLAN identification, searching an MAC forwarding table item hit by the modified message according to a target MAC address carried by the modified message and the mapping VLAN identification;
the second modification unit is specifically configured to:
and revising the mapping VLAN identification carried by the revised message into the current VLAN identification, and forwarding the revised message based on the MAC forwarding table entry.
8. The apparatus of claim 7, further comprising:
and the first updating unit is used for updating the local MAC address table of the logic switch corresponding to the mapping VLAN identification according to the modified message input interface, the source MAC address carried by the modified message and the mapping VLAN identification.
9. The apparatus according to claim 6, wherein when the data packet is a three-layer packet, the lookup unit is specifically configured to:
in a local IP forwarding table of the logic switch corresponding to the mapping VLAN identification, searching an IP forwarding table item hit by the modified message according to a destination IP address carried by the modified message and the VRF identification corresponding to the mapping VLAN identification;
in a local ARP table of a logic switch corresponding to the mapping VLAN identification, searching an ARP table item hit by the modified message according to a next hop IP address in the IP forwarding table item; wherein, the VLAN identification in the ARP list item is the current VLAN identification;
the second modification unit is specifically configured to:
based on the ARP table entry, the mapping VLAN identification carried by the modified message is modified into the current VLAN identification again, and the source MAC address and the target MAC address carried by the modified message are modified again;
and forwarding the message after being modified again based on the IP forwarding table entry.
10. The apparatus of claim 9, further comprising:
a second determining unit, configured to determine, when an ARP request packet is received, a mapping VLAN identifier corresponding to an ingress interface that receives the ARP request packet according to the preset VLAN mapping rule;
a second updating unit, configured to update a local ARP table of the logical switch corresponding to the mapping VLAN identifier according to the source MAC address and the source IP address carried in the ARP request packet and the mapping VLAN identifier;
and the constructing unit is used for constructing an ARP response message and returning the ARP response message according to the current VLAN identification carried by the ARP request message.
CN201910232434.7A 2019-03-26 2019-03-26 Message forwarding method and device Active CN109768909B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910232434.7A CN109768909B (en) 2019-03-26 2019-03-26 Message forwarding method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910232434.7A CN109768909B (en) 2019-03-26 2019-03-26 Message forwarding method and device

Publications (2)

Publication Number Publication Date
CN109768909A CN109768909A (en) 2019-05-17
CN109768909B true CN109768909B (en) 2021-04-27

Family

ID=66459849

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910232434.7A Active CN109768909B (en) 2019-03-26 2019-03-26 Message forwarding method and device

Country Status (1)

Country Link
CN (1) CN109768909B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112087388B (en) * 2020-08-17 2022-03-08 深圳市风云实业有限公司 Method for forwarding L2 data message
CN114915580B (en) * 2021-01-28 2023-06-02 中国电信股份有限公司 Data packet routing method and system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102710529A (en) * 2012-06-21 2012-10-03 杭州华三通信技术有限公司 Message forward method and equipment based on virtual device
CN102739501A (en) * 2011-04-01 2012-10-17 中兴通讯股份有限公司 Message forwarding method in two or three layer virtual private network (VPN) and system thereof
CN103220224A (en) * 2013-04-18 2013-07-24 福建星网锐捷网络有限公司 Message forwarding processing method and device and network equipment
CN104065552A (en) * 2014-06-26 2014-09-24 福建星网锐捷网络有限公司 Data transmission method and device
CN106059946A (en) * 2016-05-23 2016-10-26 杭州华三通信技术有限公司 Message forwarding method and message forwarding device
CN109104353A (en) * 2018-09-21 2018-12-28 新华三信息安全技术有限公司 A kind of method and device of data transmission

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6937576B1 (en) * 2000-10-17 2005-08-30 Cisco Technology, Inc. Multiple instance spanning tree protocol

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102739501A (en) * 2011-04-01 2012-10-17 中兴通讯股份有限公司 Message forwarding method in two or three layer virtual private network (VPN) and system thereof
CN102710529A (en) * 2012-06-21 2012-10-03 杭州华三通信技术有限公司 Message forward method and equipment based on virtual device
CN103220224A (en) * 2013-04-18 2013-07-24 福建星网锐捷网络有限公司 Message forwarding processing method and device and network equipment
CN104065552A (en) * 2014-06-26 2014-09-24 福建星网锐捷网络有限公司 Data transmission method and device
CN106059946A (en) * 2016-05-23 2016-10-26 杭州华三通信技术有限公司 Message forwarding method and message forwarding device
CN109104353A (en) * 2018-09-21 2018-12-28 新华三信息安全技术有限公司 A kind of method and device of data transmission

Also Published As

Publication number Publication date
CN109768909A (en) 2019-05-17

Similar Documents

Publication Publication Date Title
CN105684363B (en) Logic router
US9363207B2 (en) Private virtual local area network isolation
US9094335B2 (en) Packet switching label assignment across multiple packet switching forwarding groups
US9225641B2 (en) Communication between hetrogenous networks
CN106576075B (en) Method and system for operating a logical network on a network virtualization infrastructure
US10616175B2 (en) Forwarding information to forward data to proxy devices
CN109412949B (en) Data message transmission method and device
CN106878288B (en) message forwarding method and device
CN107645431B (en) Message forwarding method and device
CN106331206A (en) Domain name management method and device
US10904130B2 (en) Method for scalable computer network partitioning
US9166947B1 (en) Maintaining private connections during network interface reconfiguration
CN109768909B (en) Message forwarding method and device
CN112822104A (en) Data message processing method, device, storage medium and system
CN108199947B (en) Designated forwarder DF election method and device
CN104836738A (en) Router hardware item resource management method and device, and network equipment
CN107517129B (en) Method and device for configuring uplink interface of equipment based on OpenStack
CN114024900A (en) Data processing method and related equipment
CN108322376B (en) Route synchronization method, device and machine-readable storage medium
CN110391919B (en) Multicast traffic forwarding method and device, and electronic device
US10484281B1 (en) Router operating methods and apparatus using virtual VPN instances for hosts of remote extranet VPNs
CN105939262B (en) Label distribution method and device
WO2016173196A1 (en) Method and apparatus for learning address mapping relationship
CN113923162B (en) Message forwarding method, device, equipment and storage medium
US20130177019A1 (en) Scaling ipv4 at large datacenters with device level aggregation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant