CN107547346B - Message transmission method and device - Google Patents

Message transmission method and device Download PDF

Info

Publication number
CN107547346B
CN107547346B CN201710604988.6A CN201710604988A CN107547346B CN 107547346 B CN107547346 B CN 107547346B CN 201710604988 A CN201710604988 A CN 201710604988A CN 107547346 B CN107547346 B CN 107547346B
Authority
CN
China
Prior art keywords
message
arp
address
mac address
table entry
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
CN201710604988.6A
Other languages
Chinese (zh)
Other versions
CN107547346A (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 H3C Technologies Co Ltd
Original Assignee
Hangzhou H3C 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 H3C Technologies Co Ltd filed Critical Hangzhou H3C Technologies Co Ltd
Priority to CN201710604988.6A priority Critical patent/CN107547346B/en
Publication of CN107547346A publication Critical patent/CN107547346A/en
Application granted granted Critical
Publication of CN107547346B publication Critical patent/CN107547346B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Small-Scale Networks (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a message transmission method and a device, and the method comprises the following steps: receiving a data message through an uplink port; if the destination MAC address of the data message is the MAC address of the equipment, inquiring a hardware table through the destination IP address of the data message to obtain a hardware table item corresponding to the destination IP address; the hardware table entry comprises the corresponding relation of an IP address, a CVLAN, an MAC address and an output port; modifying the SVLAN in the data message into the CVLAN in the hardware table entry, and modifying the destination MAC address in the data message into the MAC address in the hardware table entry; and sending the modified data message through an output port in the hardware table entry. According to the technical scheme, data message transmission is achieved through three-layer forwarding, the SVLAN in the data message can be modified into the CVLAN, and N:1 VLAN mapping downlink forwarding is achieved.

Description

Message transmission 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 transmitting a packet.
Background
With the development of technology, operators provide more service types for home users based on networks, and the service types may be Internet IP service, VoD (Video on Demand) service, VoIP (Voice over Internet Protocol) service, etc., and these services are all integrated into a home gateway.
The home gateway usually allocates different VLANs (Virtual Local Area networks) for different service types, and on an access layer switch connected to the home gateway, data of each user needs to be isolated by different VLANs, which requires a very large number of VLANs. In addition, on the convergence layer switch connected with the access layer switch, because the number of the VLANs that can be provided is relatively limited, the convergence layer switch performs VLAN convergence, that is, performs N:1 VLAN mapping.
Disclosure of Invention
The application provides a message transmission method, which is applied to network equipment and comprises the following steps:
receiving a data message through an uplink port;
if the destination MAC address of the data message is the MAC address of the equipment, inquiring a hardware table through the destination IP address of the data message to obtain a hardware table item corresponding to the destination IP address; the hardware table entry comprises the corresponding relation of an IP address, a CVLAN, an MAC address and an output port;
modifying the SVLAN in the data message into the CVLAN in the hardware table entry, and modifying the destination MAC address in the data message into the MAC address in the hardware table entry;
and sending the modified data message through an output port in the hardware table entry.
The application provides a message transmission device, is applied to network equipment, the device includes:
the receiving module is used for receiving the data message through the uplink port;
the acquisition module is used for inquiring a hardware table through the destination IP address of the data message to obtain a hardware table item corresponding to the destination IP address when the destination MAC address of the data message is the MAC address of the equipment; the hardware table entry comprises the corresponding relation of an IP address, a CVLAN, an MAC address and an output port;
the modification module is used for modifying the SVLAN in the data message into the CVLAN in the hardware table entry and modifying the destination MAC address in the data message into the MAC address in the hardware table entry;
and the sending module is used for sending the modified data message through an output port in the hardware table entry.
Based on the above technical solution, in the embodiment of the present application, in the VLAN mapping networking of N:1, after receiving a data packet through an uplink port, a network device queries a hardware table (such as a FIB (Forward Information Base) table, a routing table, and the like) through a destination IP address of the data packet, and thus, the transmission of the data packet is realized through three-layer forwarding, so that an SVLAN in the data packet can be modified into a CVLAN, and the downlink forwarding of the VLAN mapping of N:1, that is, the forwarding of the data packet is realized.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments of the present application or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art according to the drawings of the embodiments of the present application.
FIG. 1 is a schematic diagram of a networking for performing VLAN mapping of N:1 in one embodiment of the present application;
fig. 2 is a flowchart of a message transmission method according to an embodiment of the present application;
fig. 3 is a block diagram of a message transmission apparatus according to an embodiment of the present application;
fig. 4 is a hardware configuration diagram of a network device according to an embodiment of the present application.
Detailed Description
The terminology used in the embodiments of the present application 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 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 is meant to encompass any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in the embodiments of the present application to describe various information, the 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. Depending on the context, moreover, the word "if" as used may be interpreted as "at … …" or "when … …" or "in response to a determination".
Fig. 1 is a schematic diagram of a network configuration for performing VLAN mapping of N:1 in this embodiment of the present application.
On each home gateway, internet IP traffic (which may be implemented by a PC (Personal Computer)) may be divided into VLAN1, VoD traffic (which may be implemented by VoD devices) may be divided into VLAN2, and VoIP traffic (which may be implemented by VoIP devices) may be divided into VLAN 3.
On an access layer switch (which may be called a corridor switch), in order to isolate the same type of service of different home gateways, each type of service of each home gateway may be divided into different VLANs, i.e., VLAN mapping of 1:1 is performed. For example, VLAN1 of home gateway 1301 is mapped to VLAN101, VLAN1 of home gateway 1302 is mapped to VLAN102, and so on. VLAN2 of home gateway 1301 is mapped to VLAN201, VLAN2 of home gateway 1302 is mapped to VLAN202, and so on. VLAN3 of home gateway 1301 is mapped to VLAN301, VLAN3 of home gateway 1302 is mapped to VLAN302, and so on. It can be seen that the number of VLANs used by the access layer switch is very large.
On a convergence layer switch (which may be called a campus switch), since the number of VLANs that can be provided by the convergence layer switch is limited, in order to save VLAN resources, VLAN convergence may be performed, and the same type of services of all home gateways are divided into the same VLAN, i.e., N:1 VLAN mapping is performed. For example, all VLANs (e.g., VLAN101-VLAN200) corresponding to internet IP traffic are mapped to VLAN501, all VLANs (e.g., VLAN201-VLAN300) corresponding to VoD traffic are mapped to VLAN502, and all VLANs (e.g., VLAN301-VLAN400) corresponding to VoIP traffic are mapped to VLAN503, so that the convergence layer switch only needs to provide 3 VLANs (e.g., VLAN501, VLAN502, and VLAN 503).
In the convergence layer switch, VLANs (such as the above-mentioned VLANs 101 to 200, 201 to 300, and 301 to 400) on the user side may be referred to as CVLAN (Customer Virtual Local Area Network), and VLANs (such as the above-mentioned VLANs 501 to 503) on the Network side may be referred to as SVLAN (Service Virtual Local Area Network).
On the convergence layer switch, a message sent from the user side to the network side may be referred to as an uplink message (e.g., a message sent by the PC1001 to the Internet via the convergence layer switch), and a message sent from the network side to the user side may be referred to as a downlink message (e.g., a message sent by the Internet to the PC1001 via the convergence layer switch).
On the convergence layer switch, the ports connected to the user side (i.e. the ports where the convergence layer switch is connected to the access layer switch) may be referred to as downlink ports (e.g. port a and port B); a port connected to the network side (i.e., a port to which the aggregation layer switch is connected to the core layer switch) is referred to as an upstream port (e.g., port C).
On the convergence layer switch, the VLAN where the upstream port is located is an SVLAN, and the VLAN where the downstream port is located is a CVLAN. Moreover, the convergence layer switch may store a corresponding relationship between the CVLAN and the SVLAN, and the corresponding relationship may be configured by a network administrator or may be obtained from an instruction of a network management system. For example, the correspondence between VLAN101-VLAN200 and VLAN501, the correspondence between VLAN201-VLAN300 and VLAN502, and the correspondence between VLAN301-VLAN400 and VLAN503 are stored.
In one example, after receiving an uplink message through a downlink port (e.g., port a or port B), the convergence layer switch queries the above correspondence relationship through a CVLAN in the uplink message, so as to query an SVLAN corresponding to the CVLAN, replaces the CVLAN in the uplink message with the queried SVLAN, and sends the uplink message through the port corresponding to the SVLAN, thereby implementing transmission of the uplink message.
In an example, after receiving a downlink message through an uplink port (e.g., port C), a convergence layer switch needs to replace an SVLAN in the downlink message with a CVLAN, but since the SVLAN in the downlink message corresponds to multiple CVLANs, for example, VLAN501 corresponds to VLANs 101 to VLAN200, in order to determine the CVLAN corresponding to the SVLAN in the downlink message, a message transmission method is provided in this embodiment of the present application, and the method may be applied to a network device, such as the above convergence layer switch, and the network device may implement transmission of a data message through three-layer forwarding, and modify the SVLAN in the data message into the CVLAN.
In this embodiment, the network device may create a hardware table and a software table, and the network device may store the hardware table to the forwarding chip and may store the software table in the memory. Each entry in the hardware table may be referred to as a hardware entry, as shown in table 1, a matching entry of the hardware table may include an IP address, and an action entry may include a CVLAN, a MAC address, and an egress port. Furthermore, each entry in the software table may be referred to as a software table entry, and as shown in table 2, the matching entry of the software table entry may include an IP address and a MAC address, and the action entry may include a CVLAN and an egress port. Further, the hardware table entry and the software table entry are different in that: the matching item of the hardware table item only comprises an IP address but not an MAC address, so that the hardware table item can be inquired by using the destination IP address of the message, namely, the forwarding based on the hardware table item can be three-layer forwarding; in addition, the matching entry of the software table entry includes an IP address and a MAC address, so that the destination MAC address of the packet may be used to query the software table entry, that is, the forwarding based on the software table entry may be two-layer forwarding.
TABLE 1
IP address VLAN MAC address Output port
TABLE 2
MAC address IP address VLAN Output port
In an example, the hardware table may be a FIB table, a routing table, or the like, and the hardware table may be integrated by using a forwarding chip of the network device, and then forwarding of the downlink data packet may be implemented based on the hardware table.
In one example, the maintenance process for the hardware table and the software table may include the following processes:
after receiving the ARP message through the downlink port, the network device updates the software table entry corresponding to the ARP message in the software table and updates the hardware table entry corresponding to the ARP message in the hardware table. The matching item of the software table entry comprises a source IP address of the ARP message and a source MAC address of the ARP message, and the action item of the software table entry comprises a CVLAN carried by the ARP message and the downlink port. The matching item of the hardware table item comprises the source IP address of the ARP message, and the action item of the hardware table item comprises the CVLAN carried by the ARP message, the source MAC address of the ARP message and the downlink port.
For these types of ARP messages, the process of the network device executing "update the software table entry corresponding to the ARP message in the software table, and update the hardware table entry corresponding to the ARP message in the hardware table" is similar, and for convenience of description, the following description will be given by taking an example in which the ARP message is an ARP request message.
Referring to fig. 1, in order to enable the PC1001 to access the Internet, a gateway IP address is configured at the PC1001, and the PC1001 can acquire the gateway MAC address by sending an ARP request message, thereby accessing the Internet based on the gateway IP address and the gateway MAC address. In fig. 1, the core layer switch 1601 is a gateway of the PC1001, and therefore, the PC1001 can send an ARP request message having a source IP address of the PC1001, a source MAC address of the PC1001, a destination IP address of the core layer switch 1601, and a destination MAC address of the broadcast MAC address.
Further, after receiving the ARP request message, the home gateway 1301 updates the local ARP entry according to the ARP request message, and the updating process is not described again, and then adds the VLAN1 to the ARP request message, and sends the ARP request message carrying the VLAN1 to the access layer switch 1401. After receiving the ARP request message, the access layer switch 1401 updates the local ARP entry according to the ARP request message, and the updating process is not described again, then modifies the VLAN1 carried in the ARP request message into the VLAN101, and sends the ARP request message carrying the VLAN101 to the convergence layer switch 1501.
Further, after the convergence layer switch 1501 (i.e., the network device) receives the ARP request message through the downlink port (i.e., port a), the software table entry corresponding to the ARP request message is updated in a software table (e.g., an ARP table), and the hardware table entry corresponding to the ARP request message is updated in a hardware table.
In one example, the software table entry may further include an aging timer, and updating the software table entry corresponding to the ARP request message in the software table may refer to: if there is no software table entry corresponding to the ARP request message in the software table (i.e. there is no software table entry corresponding to the source MAC address or the source IP address of the ARP request message), a software table entry may be added in the software table, a matching entry of the software table entry includes the source IP address and the source MAC address of the ARP request message, an action entry of the software table entry includes the CVLAN and the downlink port carried by the ARP request message, and an aging timer is set for the software table entry, as shown in table 3 (where the aging timer is not shown). And if the software table entry corresponding to the ARP request message exists in the software table, updating the aging time of the aging timer of the software table entry corresponding to the ARP request message. When the aging timer of the software table entry is overtime, the software table entry can be deleted from the software table.
In an example, the hardware table entry may further include an aging timer, and updating the hardware table entry corresponding to the ARP request packet in the hardware table may refer to: if there is no hardware table entry corresponding to the ARP request message in the hardware table (that is, there is no hardware table entry corresponding to the source IP address of the ARP request message), a hardware table entry may be added in the hardware table, where a matching entry of the hardware table entry includes the source IP address of the ARP request message, an action entry of the hardware table entry includes the CVLAN carried in the ARP request message, the source MAC address of the ARP request message, and the downlink port, and an aging timer is set for the hardware table entry, as shown in table 4 (where the aging timer is not shown). And if the hardware table entry corresponding to the ARP request message exists in the hardware table, updating the aging time of the aging timer of the hardware table entry corresponding to the ARP request message. When the aging timer of the hardware table entry times out, the hardware table entry can be deleted from the hardware table.
TABLE 3
MAC address IP address VLAN Output port
MAC Address of PC1001 IP Address of PC1001 VLAN101 Port A
TABLE 4
IP address VLAN MAC address Output port
IP Address of PC1001 VLAN101 MAC Address of PC1001 Port A
Based on the above process, the convergence layer switch 1501 can update the software table entry and the hardware table entry of the PC1001, and in the same implementation manner, the convergence layer switch 1501 can also update the software table entry and the hardware table entry of the VoD device 1101, update the software table entry and the hardware table entry of the VoIP device 1201, update the software table entry and the hardware table entry of the PC1002, and so on, thereby completing the table entry updating process of each terminal device.
In an example, after receiving the ARP request message through the port a, the convergence layer switch 1501 may further modify the VLAN101 carried in the ARP request message into the VLAN501, and send the ARP request message carrying the VLAN501 to the core layer switch 1601 through the interface C. The reason why the VLAN101 carried in the ARP request message is modified to the VLAN501 is as follows: the convergence layer switch will map all VLANs (e.g., VLAN101-VLAN200) corresponding to internet IP traffic to VLAN 501.
After receiving the ARP request message, the core layer switch 1601 updates the local ARP entry according to the ARP request message, and details of the updating process are omitted. Then, since the destination IP address of the ARP request message is the IP address of the core layer switch 1601, the core layer switch 1601 transmits an ARP response message, the source IP address of which is the IP address of the core layer switch 1601, the source MAC address of which is the MAC address of the core layer switch 1601, the destination IP address of which is the IP address of the PC1001, and the destination MAC address of which is the MAC address of the PC 1001. In addition, the ARP response message may be transmitted to the PC1001 after passing through the convergence layer switch 1501, the access layer switch 1401, and the home gateway 1301, so that the PC1001 may resolve the MAC address of the core layer switch 1601 from the ARP response message.
Considering that each terminal device on the user side sends an ARP request message to the core layer switch 1601, the above manner may cause a large number of ARP request messages to be transmitted between the convergence layer switch 1501 and the core layer switch 1601, which affects the bandwidth and the device performance. Therefore, in another example, the convergence layer switch 1501 may return an ARP reply message to the terminal device instead of the core layer switch 1601, thereby reducing the number of ARP request message transmissions between the convergence layer switch 1501 and the core layer switch 1601, saving bandwidth, and improving device processing performance.
In order to implement the above-mentioned reply function, after receiving the ARP request message through the downlink port, the convergence layer switch may also query the software table through the destination IP address of the ARP request message to obtain a software table entry corresponding to the destination IP address, where the software table entry may include a corresponding relationship between an IP address, an MAC address, an SVLAN, and an egress port. Then, the convergence layer switch generates an ARP response message aiming at the ARP request message, and sends the ARP response message through the downlink port. The source MAC address of the ARP response packet may be an MAC address in a software table entry, that is, an MAC address of the core layer switch.
After receiving the ARP request message through the downlink port, the convergence layer switch may also determine whether a software table entry corresponding to the destination IP address of the ARP request message exists in the software table.
If the virtual local area network (SVLAN) exists, analyzing the SVLAN from the software table entry, and if the SVLAN is the mapping VLAN corresponding to the CVLAN carried by the ARP request message, the convergence layer switch adopts a proxy response function to execute the process of generating an ARP response message aiming at the ARP request message and sending the ARP response message through the downlink port. If the SVLAN is not the mapping VLAN corresponding to the CVLAN carried by the ARP request message, the convergence layer switch does not adopt a proxy answering function and adopts the traditional flow to process.
If the virtual local area network (CVLAN) does not exist, the convergence layer switch determines a mapping VLAN (virtual local area network) corresponding to the CVLAN carried by the ARP request message, namely SVLAN, and sends the ARP request message through an uplink port corresponding to the SVLAN, wherein the source IP address of the ARP request message is the IP address of the equipment, the source MAC address is the MAC address of the equipment, and the target IP address is the IP address of the core layer switch (namely the target IP address of the ARP request message received by the convergence layer switch). After receiving the ARP request message, the core layer switch may return an ARP response message to the convergence layer switch, and the convergence layer switch may add a software entry to the software table, where the software entry may include an IP address (IP address of the core layer switch), an MAC address (MAC address of the core layer switch), and a correspondence between the SVLAN and an egress port (i.e., the uplink port). Then, based on the software table entry (i.e. the software table entry corresponding to the ARP request message received by the convergence layer switch), the convergence layer switch may perform a process of "generating an ARP response message for the ARP request message, and sending the ARP response message through the downlink port" by using a proxy function.
For example, after receiving the ARP request message through the port a, the convergence layer switch 1501 queries the software table through the destination IP address of the ARP request message (i.e., the IP address of the core layer switch 1601).
If the software table has a software table entry corresponding to the destination IP address, and if the software table shown in table 5 has a software table entry corresponding to the destination IP address, an ARP response message is generated, where a source IP address of the ARP response message is an IP address of the core layer switch 1601, a source MAC address is an MAC address of the core layer switch 1601, a destination IP address is an IP address of the PC1001, and a destination MAC address is an MAC address of the PC1001, and the ARP response message is sent through the port a. Further, the ARP response message may be transmitted to the PC1001 after passing through the access layer switch 1401 and the home gateway 1301, so that the PC1001 may resolve the MAC address of the core layer switch 1601 from the ARP response message.
TABLE 5
MAC address IP address VLAN Output port
MAC Address of PC1001 IP Address of PC1001 VLAN101 Port A
MAC address of core layer switch 1601 IP address of core layer switch 1601 VLAN501 Port C
If the software table does not have a software table entry corresponding to the destination IP address, for example, the software table shown in table 3 does not have a software table entry corresponding to the destination IP address, a mapping VLAN corresponding to VLAN101 carried in the ARP request message, that is, VLAN501, is determined, and the ARP request message is sent through port C corresponding to VLAN501, where a source IP address of the ARP request message is an IP address of convergence layer switch 1501, a source MAC address is an MAC address of convergence layer switch 1501, and a destination IP address is an IP address of core layer switch 1601. After receiving the ARP response packet for the ARP request packet, the convergence layer switch 1501 adds a software table entry in the software table according to the ARP response packet, as shown in table 5. Then, based on this software table entry, the convergence layer switch 1501 generates an ARP response message whose source IP address is the IP address of the core layer switch 1601, source MAC address is the MAC address of the core layer switch 1601, destination IP address is the IP address of the PC1001, and destination MAC address is the MAC address of the PC1001, and sends the ARP response message through the port a. Further, the ARP response message may be transmitted to the PC1001 after passing through the access layer switch 1401 and the home gateway 1301, so that the PC1001 may resolve the MAC address of the core layer switch 1601 from the ARP response message.
Based on the above process, the convergence layer switch 1501 can send an ARP response message to the PC1001, so that the PC1001 can resolve the MAC address of the core layer switch 1601 from the ARP response message and access the network according to the MAC address of the core layer switch 1601, thereby implementing the access process of the PC 1001.
In one example, in order to enable the convergence layer switch 1501 to perform three-layer forwarding based on a hardware entry, that is, to query the hardware entry based on a destination IP address, instead of querying the hardware entry based on a destination MAC address, in this embodiment of the present application, after receiving the ARP request message sent by the core layer switch 1601, the convergence layer switch 1501 may generate an ARP reply message by using the IP address and the MAC address of the device, and send the ARP reply message to the core layer switch 1601, so as to reply the ARP request message of the terminal device.
In order to realize the answer-substituting function, after the convergence layer switch receives the ARP request message through the uplink port, the convergence layer switch inquires a software table through a target IP address of the ARP request message; if the software table item corresponding to the target IP address exists in the software table, generating an ARP response message aiming at the ARP request message, and sending the ARP response message through the uplink port. The source MAC address of the ARP response packet is the MAC address of the device, and the source IP of the ARP response packet is the destination IP address of the ARP request packet.
After the convergence layer switch receives the ARP request message through the uplink port, it may also first determine whether a software table entry corresponding to the destination IP address of the ARP request message exists in the software table.
If the ARP request message exists, the CVLAN is analyzed from the software table entry (used for recording the IP address of the terminal equipment, the MAC address of the terminal equipment and the VLAN corresponding to the terminal equipment), and if the SVLAN carried by the ARP request message is the mapping VLAN corresponding to the CVLAN, the aggregation layer switch adopts a response function to execute a process of generating an ARP response message aiming at the ARP request message and sending the ARP response message through the uplink port. If the SVLAN carried by the ARP request message is not the mapping VLAN corresponding to the CVLAN, the convergence layer switch does not adopt a substitute answering function and adopts the traditional flow to process.
If not, the convergence layer switch determines all CVLANs corresponding to the SVLAN carried by the ARP request message, and for each CVLAN, may send the ARP request message carrying the CVLAN at a downlink port corresponding to the CVLAN, where a source IP address of the ARP request message is an IP address of the device, a source MAC address of the device is an MAC address of the device, and a destination IP address of the device is an IP address of the terminal device (i.e., a destination IP address of the ARP request message received by the convergence layer switch). After receiving the ARP request message, the terminal device may return an ARP response message to the convergence layer switch if the destination IP address of the ARP request message is the IP address of the terminal device. After receiving the ARP response message, the convergence layer switch may perform an operation of "after receiving the ARP response message through the downlink port, updating the software table entry corresponding to the ARP response message in the software table, and updating the hardware table entry corresponding to the ARP response message in the hardware table". Then, based on the software table entry (i.e. the software table entry corresponding to the ARP request message received by the convergence layer switch), the convergence layer switch performs a proxy function to perform a process of "generating an ARP response message for the ARP request message, and sending the ARP response message through the uplink port".
For example, after receiving the ARP request message through port C, the convergence layer switch 1501 queries the software table through the destination IP address of the ARP request message (e.g., the IP address of the PC 1001).
If a software table entry corresponding to the destination IP address exists in the software table, for example, if the software table shown in table 5 has a software table entry corresponding to the destination IP address, the VLAN101 is resolved from the software table entry, and since the VLAN501 carried in the ARP request message is a mapped VLAN corresponding to the VLAN101, the convergence layer switch 1501 uses a proxy function to send an ARP response message through the port C, where a source MAC address of the ARP response message is an MAC address of the convergence layer switch 1501, a source IP address is an IP address of the PC, a destination IP address is an IP address of the core layer switch 1001, and a destination MAC address is an MAC address of the core layer switch 1601. After receiving the ARP response message, the core layer switch 1601 recognizes that the IP address of the PC1001 and the MAC address of the convergence layer switch 1501 are the same device.
If the software table does not have the software table entry corresponding to the destination IP address, all CVLANs corresponding to the VLAN501 carried by the ARP request message, that is, VLANs 101 to 200, are determined, the ARP request message carrying the VLAN101 is sent to the port a corresponding to the VLAN101, the ARP request message carrying the VLAN102 is sent to the port a corresponding to the VLAN102, and so on, the ARP request message carrying the VLAN200 is sent to the port B corresponding to the VLAN 200. The source IP address of the ARP request message is the IP address of the device itself, the source MAC address is the MAC address of the device itself, and the destination IP address is the IP address of the PC 1001.
For other terminal devices except PC1001, after receiving the ARP request message, the ARP request message is discarded directly. After receiving the ARP request message, PC1001 may return an ARP response message to the convergence layer switch. After receiving the ARP response message, the convergence layer switch 1501 updates the software table entry corresponding to the ARP response message in the software table, and updates the hardware table entry corresponding to the ARP response message in the hardware table, which is not described in detail herein. Then, the convergence layer switch 1501 may send an ARP response message through the port C, where a source MAC address of the ARP response message is the MAC address of the convergence layer switch 1501, a source IP address is the IP address of the PC1001, a destination IP address is the IP address of the core layer switch 1601, and a destination MAC address is the MAC address of the core layer switch 1601.
Based on the above process, the core layer switch 1601 may learn a correspondence between the MAC address of the convergence layer switch 1501 and the IP address of the PC1001, and send a data packet based on the correspondence.
Referring to fig. 2, which is a flowchart of a message transmission method provided in this embodiment of the present application, the method may be applied to a network device (such as the aggregation layer switch described above), and for example, when the network device receives a downlink data message, details of a processing process of the network device receiving the uplink data message are not repeated here.
Step 201, a data message is received through an uplink port.
Step 202, if the destination MAC address of the data packet is the MAC address of the device, the hardware table is queried through the destination IP address of the data packet, and a hardware table entry corresponding to the destination IP address is obtained. The hardware table entry includes the corresponding relation of the IP address, the CVLAN, the MAC address and the output port.
Step 203, modify the SVLAN in the data message into CVLAN in the hardware table entry, and modify the destination MAC address in the data message into the MAC address in the hardware table entry.
Step 204, sending the modified data message through the output port in the hardware table entry.
Referring to fig. 1, when there is a data message sent to PC1001 on the Internet, core layer switch 1601 records the correspondence between the MAC address of convergence layer switch 1501 and the IP address of PC1001 after receiving the data message (the destination IP address is the IP address of PC 1001), so core layer switch 1601 sends the data message to convergence layer switch 1501 with the destination IP address being the IP address of PC1001 and the destination MAC address being the MAC address of convergence layer switch 1501.
After the convergence layer switch 1501 receives the data packet through the port C (i.e., the uplink port), because the destination MAC address of the data packet is the MAC address of the device, the hardware table shown in table 4 is queried through the destination IP address of the data packet (the IP address of the PC 1001), so as to obtain the hardware table entry corresponding to the destination IP address, where the hardware table entry includes the corresponding relationship among the IP address of the PC1001, the VLAN101, the MAC address of the PC1001, and the port a. Then, the convergence layer switch 1501 modifies the SVLAN in the data packet to VLAN101, modifies the destination MAC address in the data packet to the MAC address of the PC1001, and transmits the modified data packet through port a. The destination MAC address of the modified data packet is the MAC address of the PC1001, and the destination IP address is the IP address of the PC1001 and carries the VLAN 101. After passing through the access layer switch 1401 and the home gateway 1301, the data packet may be transmitted to the PC1001, so that the data packet is successfully transmitted to the PC 1001.
The reason why the destination MAC address is the MAC address of the device on the convergence layer switch 1501 is as follows: after receiving the data message, if the destination MAC address is not the MAC address of the device, the forwarding chip queries the hardware table based on the destination MAC address, and even if a hardware table entry corresponding to the destination MAC address exists in the hardware table, the forwarding chip only supports sending the data message through the output port, but does not support modifying the SVLAN in the data message into the CVLAN in the hardware table entry. Therefore, after the above-mentioned solution of the embodiment of the present application is adopted, after the forwarding chip receives the data packet, because the destination MAC address is the MAC address of the device, the forwarding chip queries the hardware table based on the destination IP address, so that if a hardware table entry corresponding to the destination IP address exists in the hardware table, the forwarding chip can support modifying the SVLAN in the data packet into the CVLAN in the hardware table entry, thereby implementing transmission of the data packet.
In the foregoing manner, after receiving the data packet, the convergence layer switch 1501 implements data packet transmission based on three-layer forwarding, but unlike the conventional three-layer forwarding, in the embodiment of the present application, the three-layer forwarding is used to simulate two-layer forwarding. In addition, in practical applications, if the packet is forwarded in three layers, the convergence layer switch 1501 needs To modify a TTL (Time To Live value) of the data packet, and if the packet is forwarded in two layers, the convergence layer switch 1501 does not need To modify the TTL of the data packet.
In summary, in the embodiment of the present application, three-layer forwarding is used to simulate two-layer forwarding, so that the convergence layer switch 1501 does not need to modify the TTL of the data packet, and in order to implement the above functions, the following steps are performed: the hardware table entry corresponding to the destination IP address of the data packet may further include a specific flag, and the specific flag is used to indicate that the TTL is not modified. Based on this, after the hardware table is queried through the destination IP address of the data packet to obtain the hardware table entry corresponding to the destination IP address, if the hardware table entry includes the specific mark, it is determined that the TTL of the data packet is not modified according to the specific mark.
Based on the technical scheme, in the embodiment of the application, after receiving the data message through the uplink port, the network device queries the hardware table through the destination IP address of the data message, so that the transmission of the data message is realized through three-layer forwarding, and therefore, the SVLAN in the data message can be modified into the CVLAN, and the downlink forwarding of the N:1 VLAN mapping is realized, that is, the data message forwarding is realized.
Based on the same application concept as the method, a message transmission apparatus is also provided in this embodiment of the present application, where the message transmission apparatus may be applied to a network device, and as shown in fig. 3, the message transmission apparatus is a structural diagram of the message transmission apparatus provided in this embodiment of the present application, and the message transmission apparatus may include:
a receiving module 301, configured to receive a data packet through an uplink port; an obtaining module 302, configured to, when a destination MAC address of the data packet is an MAC address of the device, query a hardware table according to the destination IP address of the data packet to obtain a hardware table entry corresponding to the destination IP address; the hardware table entry comprises the corresponding relation of an IP address, a CVLAN, an MAC address and an output port; a modifying module 303, configured to modify an SVLAN in the data packet into a CVLAN in a hardware table entry, and modify a destination MAC address in the data packet into a MAC address in the hardware table entry; a sending module 304, configured to send the modified data packet through an egress port in the hardware table entry.
In one example, the message transmission device further includes (not shown in the figure):
the updating module is used for updating a software table entry corresponding to the ARP message in a software table and updating a hardware table entry corresponding to the ARP message in a hardware table after the ARP message is received through the downlink port;
the matching item of the software table entry comprises a source IP address of the ARP message and a source MAC address of the ARP message, and the action item comprises a CVLAN carried by the ARP message and the downlink port;
the matching item of the hardware table item comprises a source IP address of the ARP message, and the action item comprises a CVLAN carried by the ARP message, a source MAC address of the ARP message and the downlink port.
The obtaining module 302 is further configured to, after receiving an ARP request packet through a downlink port, query a software table according to a destination IP address of the ARP request packet to obtain a software table entry corresponding to the destination IP address; the software table entry comprises the corresponding relation of an IP address, an MAC address and an output port;
the sending module 304 is further configured to generate an ARP response packet for the ARP request packet, and send the ARP response packet through the downlink port; wherein, the source MAC address of the ARP response message is the MAC address in the software table entry; further, the software table entry may further include a SVLAN, and the sending module 304 is further configured to generate an ARP response packet for the ARP request packet if the SVLAN is a mapping VLAN corresponding to the CVLAN carried in the ARP request packet in the process of generating the ARP response packet for the ARP request packet.
The sending module 304 is further configured to determine, when there is no software entry corresponding to the destination IP address, an SVLAN corresponding to a CVLAN carried in the ARP request packet, and send the ARP request packet through an uplink port corresponding to the SVLAN, where a source MAC address of the ARP request packet is an MAC address of the device;
and the updating module is also used for updating the software table entry corresponding to the ARP response message in a software table after the ARP response message aiming at the ARP request message is received through the uplink port.
The sending module 304 is further configured to query a software table through a destination IP address of the ARP request packet after receiving the ARP request packet through the uplink port; if the software table has a software table entry corresponding to the target IP address, generating an ARP response message aiming at the ARP request message, and sending the ARP response message through the uplink port; wherein, the source MAC address of the ARP response message is the MAC address of the equipment;
further, the software table entry comprises a corresponding relation of an IP address, an MAC address, a CVLAN and an output port; the sending module 304 is further configured to, in the process of generating an ARP response packet for the ARP request packet, generate an ARP response packet for the ARP request packet if the SVLAN carried in the ARP request packet is the mapping VLAN corresponding to the CVLAN in the software table entry.
In the network device provided in the embodiment of the present application, from a hardware level, a schematic diagram of a hardware architecture may specifically refer to fig. 4. The method comprises the following steps: a machine-readable storage medium and a processor, wherein:
a machine-readable storage medium: the instruction code is stored.
A processor: the message transmission operation disclosed in the above example of the present application is realized by communicating with a machine-readable storage medium, reading and executing the instruction codes stored in the machine-readable storage medium.
Here, a machine-readable storage medium may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and so forth. For example, the machine-readable storage medium may be: a RAM (random Access Memory), a volatile Memory, a non-volatile Memory, a flash Memory, a storage drive (e.g., a hard drive), a solid state drive, any type of storage disk (e.g., an optical disk, a dvd, etc.), or similar storage medium, or a combination thereof.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Furthermore, these computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (11)

1. A message transmission method is applied to network equipment, and the method comprises the following steps:
after receiving an ARP request message through an uplink port, inquiring a software table through a target IP address of the ARP request message; if the software table has a software table entry corresponding to the target IP address of the ARP request message, generating an ARP response message aiming at the ARP request message, and sending the ARP response message through the uplink port; the source MAC address of the ARP response message is the MAC address of the equipment, wherein the software table entry comprises the corresponding relation of an IP address, the MAC address, a VLAN and an output port;
receiving a data message through an uplink port;
if the destination MAC address of the data message is the MAC address of the equipment, inquiring a hardware table through the destination IP address of the data message to obtain a hardware table item corresponding to the destination IP address of the data message; the hardware table entry comprises a corresponding relation of an IP address, a CVLAN, an MAC address and an output port, and further comprises a specific mark, wherein the specific mark is used for indicating that TTL modification is not performed;
modifying the SVLAN in the data message into the CVLAN in the hardware table entry, modifying the destination MAC address in the data message into the MAC address in the hardware table entry, and not modifying the TTL of the data message according to the indication of the specific mark;
and sending the modified data message through an output port in the hardware table entry.
2. The method of claim 1, further comprising:
after receiving an ARP message through a downlink port, updating a software table entry corresponding to the ARP message in a software table, and updating a hardware table entry corresponding to the ARP message in a hardware table;
the matching item of the software table entry comprises a source IP address of the ARP message and a source MAC address of the ARP message, and the action item comprises a CVLAN carried by the ARP message and the downlink port;
the matching item of the hardware table item comprises a source IP address of the ARP message, and the action item comprises a CVLAN carried by the ARP message, a source MAC address of the ARP message and the downlink port.
3. The method of claim 1, further comprising:
after receiving an ARP request message through a downlink port, inquiring a software table through a target IP address of the ARP request message to obtain a software table item corresponding to the target IP address; the software table entry comprises the corresponding relation of an IP address, an MAC address and an output port; generating an ARP response message aiming at the ARP request message, and sending the ARP response message through the downlink port; and the source MAC address of the ARP response message is the MAC address in the software table entry.
4. The method according to claim 3, wherein the software table entry further includes a SVLAN, and the process of generating an ARP response message for an ARP request message specifically includes:
and if the SVLAN is the mapping VLAN corresponding to the CVLAN carried by the ARP request message, generating an ARP response message aiming at the ARP request message.
5. The method according to claim 3, wherein after querying a software table by the destination IP address of the ARP request message, the method further comprises:
if the software table entry corresponding to the target IP address does not exist, determining an SVLAN corresponding to a CVLAN carried by the ARP request message, and sending the ARP request message through an uplink port corresponding to the SVLAN, wherein the source MAC address of the ARP request message is the MAC address of the equipment;
and after receiving an ARP response message aiming at the ARP request message through the uplink port, updating a software table entry corresponding to the ARP response message in a software table.
6. The method of claim 1,
the software table entry comprises the corresponding relation of an IP address, an MAC address, a CVLAN and an output port;
the process of generating an ARP response packet for the ARP request packet specifically includes:
and if the SVLAN carried by the ARP request message is a mapping VLAN corresponding to the CVLAN in the software table entry, generating an ARP response message aiming at the ARP request message.
7. A message transmission apparatus, applied to a network device, the apparatus comprising:
the system comprises a sending module, a receiving module and a sending module, wherein the sending module is used for inquiring a software table through a target IP address of an ARP request message after the ARP request message is received through an uplink port; if the software table has a software table entry corresponding to the target IP address, generating an ARP response message aiming at the ARP request message, and sending the ARP response message through the uplink port; the source MAC address of the ARP response message is the MAC address of the equipment, wherein the software table entry comprises the corresponding relation of an IP address, the MAC address, a VLAN and an output port;
the receiving module is used for receiving the data message through the uplink port;
the acquisition module is used for inquiring a hardware table through the destination IP address of the data message to obtain a hardware table item corresponding to the destination IP address of the data message when the destination MAC address of the data message is the MAC address of the equipment; the hardware table entry comprises the corresponding relation of an IP address, a CVLAN, an MAC address and an output port, and also comprises a specific mark which is used for indicating that TTL modification is not carried out;
a modification module, configured to modify an SVLAN in a data packet into a CVLAN in a hardware table entry, modify a destination MAC address in the data packet into an MAC address in the hardware table entry, and not modify a TTL of the data packet according to an indication of the specific flag;
and the sending module is used for sending the modified data message through an output port in the hardware table entry.
8. The apparatus of claim 7, further comprising:
the updating module is used for updating a software table entry corresponding to the ARP message in a software table and updating a hardware table entry corresponding to the ARP message in a hardware table after the ARP message is received through the downlink port;
the matching item of the software table entry comprises a source IP address of the ARP message and a source MAC address of the ARP message, and the action item comprises a CVLAN carried by the ARP message and the downlink port;
the matching item of the hardware table item comprises a source IP address of the ARP message, and the action item comprises a CVLAN carried by the ARP message, a source MAC address of the ARP message and the downlink port.
9. The apparatus of claim 7,
the acquisition module is also used for inquiring a software table through a target IP address of the ARP request message after the ARP request message is received through the downlink port to obtain a software table item corresponding to the target IP address; the software table entry comprises the corresponding relation of an IP address, an MAC address and an output port;
the sending module is further configured to generate an ARP response packet for the ARP request packet, and send the ARP response packet through the downlink port; wherein, the source MAC address of the ARP response message is the MAC address in the software table entry;
the software table entry further comprises an SVLAN, and the sending module is further configured to generate an ARP response message for the ARP request message if the SVLAN is a mapping VLAN corresponding to the CVLAN carried in the ARP request message in the process of generating the ARP response message for the ARP request message.
10. The apparatus of claim 9,
the sending module is further configured to determine, when there is no software entry corresponding to the destination IP address, an SVLAN corresponding to a CVLAN carried in the ARP request packet, and send the ARP request packet through an uplink port corresponding to the SVLAN, where a source MAC address of the ARP request packet is an MAC address of the device;
and the updating module is also used for updating the software table entry corresponding to the ARP response message in a software table after the ARP response message aiming at the ARP request message is received through the uplink port.
11. The apparatus of claim 7, wherein the software table entry comprises a correspondence of an IP address, a MAC address, a CVLAN, and an egress port; the sending module is further configured to, in a process of generating an ARP response packet for the ARP request packet, generate an ARP response packet for the ARP request packet if the SVLAN carried in the ARP request packet is a mapped VLAN corresponding to the CVLAN in the software table entry.
CN201710604988.6A 2017-07-24 2017-07-24 Message transmission method and device Active CN107547346B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710604988.6A CN107547346B (en) 2017-07-24 2017-07-24 Message transmission method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710604988.6A CN107547346B (en) 2017-07-24 2017-07-24 Message transmission method and device

Publications (2)

Publication Number Publication Date
CN107547346A CN107547346A (en) 2018-01-05
CN107547346B true CN107547346B (en) 2021-02-26

Family

ID=60970701

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710604988.6A Active CN107547346B (en) 2017-07-24 2017-07-24 Message transmission method and device

Country Status (1)

Country Link
CN (1) CN107547346B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109039679B (en) * 2017-06-08 2021-07-13 中国移动通信集团浙江有限公司 NFV network signaling acquisition method and device
CN111371693B (en) * 2018-12-25 2023-01-10 深圳市中兴微电子技术有限公司 Method and system for fast message forwarding through hardware and software
CN110149263B (en) * 2019-04-17 2021-08-06 浪潮思科网络科技有限公司 VLAN ACCESS port function expansion device and method
CN113037539B (en) * 2021-02-05 2022-05-27 新华三信息安全技术有限公司 Fault positioning method and device
CN115118546A (en) * 2022-06-15 2022-09-27 浪潮思科网络科技有限公司 Method, device, system and medium for implementing private virtual local area network

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1946041B (en) * 2006-06-20 2010-08-18 杭州华三通信技术有限公司 VLAN polymerizing method, converging exchanger and system based on ARP detector intercept
CN103404084A (en) * 2012-11-21 2013-11-20 华为技术有限公司 MAC address forced forwarding device and method
CN103780494A (en) * 2014-02-11 2014-05-07 杭州华三通信技术有限公司 User information obtaining method and device
CN105490911A (en) * 2014-09-19 2016-04-13 杭州华三通信技术有限公司 Virtual local area network mapping method and apparatus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1946041B (en) * 2006-06-20 2010-08-18 杭州华三通信技术有限公司 VLAN polymerizing method, converging exchanger and system based on ARP detector intercept
CN103404084A (en) * 2012-11-21 2013-11-20 华为技术有限公司 MAC address forced forwarding device and method
CN103780494A (en) * 2014-02-11 2014-05-07 杭州华三通信技术有限公司 User information obtaining method and device
CN105490911A (en) * 2014-09-19 2016-04-13 杭州华三通信技术有限公司 Virtual local area network mapping method and apparatus

Also Published As

Publication number Publication date
CN107547346A (en) 2018-01-05

Similar Documents

Publication Publication Date Title
CN107547346B (en) Message transmission method and device
EP2600573B1 (en) Method for transmitting addresses correspondence relationship in second-layer protocol using link status routing
CN108259347B (en) Message transmission method and device
US20170099194A1 (en) Service flow processing method, apparatus, and device
EP2860882B1 (en) Service processing method, device and system
EP2654250A2 (en) Virtual local area network identity transformation method and apparatus
CN109729012B (en) Unicast message transmission method and device
CN106921578B (en) Method and device for generating forwarding table item
US9825861B2 (en) Packet forwarding method, apparatus, and system
CN109714274B (en) Method for acquiring corresponding relation and routing equipment
CN108965092B (en) Data message transmission method and device
US8472420B2 (en) Gateway device
CN111010329B (en) Message transmission method and device
EP3313031B1 (en) Sdn-based arp realization method and apparatus
CN109412949B (en) Data message transmission method and device
CN105227466A (en) Communication processing method and device
CN103581022A (en) MAC address finding and transmitting method and device
CN105187311A (en) Message forwarding method and message forwarding device
CN110391919B (en) Multicast traffic forwarding method and device, and electronic device
CN105490911A (en) Virtual local area network mapping method and apparatus
CN115865844B (en) Virtual-real combined dynamic flow scheduling method and device based on SDN (software defined network) and NDN (non-dynamic network)
CN108632125B (en) Multicast table item management method, device, equipment and machine readable storage medium
WO2018161827A1 (en) Address self-learning method and device, and switch
CN111654558B (en) ARP interaction and intranet flow forwarding method, device and equipment
CN105207904A (en) Message processing method, device and router

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