Traffic processing method, device and storage medium

文档序号:1538029 发布日期:2020-02-14 浏览:6次 中文

阅读说明:本技术 流量处理方法、装置和存储介质 (Traffic processing method, device and storage medium ) 是由 张锋 翟云箭 陈晓帆 古亮 于 2019-10-31 设计创作,主要内容包括:本发明公开了一种流量处理方法,所述方法应用于交换机,包括:接收待处理流量;按照预设分类规则对所述待处理流量进行流量分类,获得所述待处理流量的流量类型;当所述待处理流量的流量类型为ARP流量时,将所述待处理流量转发至ARP流表;利用所述ARP流表的ARP流量处理命令,对所述待处理流量进行处理。本发明还公开了一种流量处理装置、交换机和存储介质。本发明实现了在交换机本地进行ARP流量处理,简化了流量处理过程,降低了资源的消耗和流量处理时长。(The invention discloses a flow processing method, which is applied to a switch and comprises the following steps: receiving flow to be processed; carrying out flow classification on the flow to be processed according to a preset classification rule to obtain the flow type of the flow to be processed; when the flow type of the flow to be processed is ARP flow, forwarding the flow to be processed to an ARP flow table; and processing the flow to be processed by using the ARP flow processing command of the ARP flow table. The invention also discloses a flow processing device, a switch and a storage medium. The invention realizes the ARP flow processing in the local switch, simplifies the flow processing process, and reduces the resource consumption and the flow processing time.)

1. A traffic processing method is applied to a switch, and comprises the following steps:

receiving flow to be processed;

carrying out flow classification on the flow to be processed according to a preset classification rule to obtain the flow type of the flow to be processed;

if the flow type of the flow to be processed is ARP flow, forwarding the flow to be processed to an ARP flow table;

and processing the flow to be processed by using the ARP flow processing command of the ARP flow table.

2. The traffic processing method according to claim 1, wherein the step of processing the traffic to be processed by using the ARP traffic processing command of the ARP flow table specifically includes:

determining the request type of the flow to be processed by using an ARP flow processing command of the ARP flow table;

and if the flow to be processed is an ARP request message, responding to the ARP request message according to an address relation mapping table, wherein the address relation mapping table comprises the mapping relation between the MAC address and the IP address.

3. The traffic processing method according to claim 2, wherein the step of responding to the ARP request packet according to an address relationship mapping table if the traffic to be processed is an ARP request packet specifically comprises:

if the flow to be processed is an ARP request message, acquiring an IP address to be matched or an MAC address to be matched carried in the flow to be processed;

searching a local address relation mapping table according to the IP address to be matched or the MAC address to be matched to obtain target address information;

and constructing a response message according to the target address information, and returning the response message to the sending host of the flow to be processed.

4. The traffic processing method according to claim 2, wherein after the step of determining the request type of the traffic to be processed using the ARP traffic processing command of the ARP flow table, the traffic processing method further comprises:

if the flow to be processed is an ARP free message, forwarding the flow to be processed to a broadcast flow table;

and sending the flow to be processed to a plurality of ports in a broadcast domain according to the broadcast command of the broadcast flow table.

5. The traffic processing method according to claim 1, wherein after the step of performing traffic classification on the traffic to be processed according to a preset classification rule to obtain the traffic type of the traffic to be processed, the traffic processing method further comprises:

if the flow type of the flow to be processed is unicast flow, forwarding the flow to be processed to a dynamic learning flow table;

according to the processing command of the dynamic learning flow table, matching a first destination address for the flow to be processed by using a local self-learning address table; the self-learning address table is generated through address information received by each port;

and sending the flow to be processed to a port corresponding to the first destination address.

6. The traffic processing method according to claim 5, wherein after the step of matching the to-be-processed traffic with the local self-learning address table to the first destination address according to the processing command of the dynamic learning flow table, the traffic processing method further comprises:

if the first destination address of the flow to be processed is not matched, forwarding the flow to be processed to a unicast flow table;

according to the unicast command of the unicast flow table, matching a second destination address for the flow to be processed by utilizing a prestored address table;

and sending the flow to be processed to a port corresponding to the second destination address.

7. The traffic processing method according to claim 6, wherein after the step of matching the traffic to be processed with a second destination address using a pre-stored address table according to the unicast command of the unicast flow table, the traffic processing method further comprises:

if the second destination address of the flow to be processed is not matched, forwarding the flow to be processed to a broadcast flow table;

and sending the flow to be processed to a plurality of ports in a broadcast domain according to the broadcast command of the broadcast flow table.

8. The traffic processing method according to claim 1, wherein after the step of performing traffic classification on the traffic to be processed according to a preset classification rule to obtain the traffic type of the traffic to be processed, the traffic processing method further comprises:

if the flow type of the flow to be processed is broadcast flow, forwarding the flow to be processed to a broadcast flow table;

and sending the flow to be processed to a plurality of ports in a broadcast domain according to the broadcast command of the broadcast flow table.

9. A flow processing device, characterized in that the flow processing device comprises:

the receiving module is used for receiving the flow to be processed;

the classification module is used for carrying out flow classification on the flow to be processed according to a preset classification rule to obtain the flow type of the flow to be processed;

the forwarding module is used for forwarding the flow to be processed to an ARP flow table if the flow type of the flow to be processed is the ARP flow;

and the ARP flow processing module is used for processing the flow to be processed according to the ARP flow processing command of the ARP flow table.

10. A flow processing device, characterized in that the flow processing device comprises: memory, a processor and a traffic handling program stored on the memory and executable on the processor, the traffic handling program when executed by the processor implementing the steps of the traffic handling method according to any of claims 1 to 8.

11. A storage medium, characterized in that the storage medium has stored thereon a traffic handling program which, when executed by a processor, implements the steps of the traffic handling method according to any one of claims 1 to 8.

Technical Field

The present invention relates to the field of communications technologies, and in particular, to a traffic processing method, an apparatus, and a storage medium.

Background

A service function chain (service function chain) is a technology that connects physical/virtual function components, mainly L4-L7 layer function components (such as firewall, VPN), in a certain order, and allows specific traffic to pass through these security components in a predetermined order. In the current traffic processing mode, the controller is responsible for traffic control, and the switch performs traffic forwarding according to the command of the controller, and does not respond to the request of the traffic message. When the switch receives an Address Resolution Protocol (ARP) request message, the ARP request message is uploaded to the controller, so that the controller responds to the ARP request message. When the ARP request message is received, the flow processing method needs to report the flow on the switch, the controller responds, and the switch performs corresponding flow forwarding according to the instruction of the controller, so that the whole process is complex, resources are consumed, and the processing time is too long.

The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.

Disclosure of Invention

The invention mainly aims to provide a flow processing method, a flow processing device and a storage medium, and aims to solve the technical problems that a flow processing process is complex and resources are consumed for a long time because a switch cannot process ARP flow locally.

In order to achieve the above object, the present invention provides a traffic processing method, where the method is applied to a switch, and the traffic processing method includes: receiving flow to be processed; carrying out flow classification on the flow to be processed according to a preset classification rule to obtain the flow type of the flow to be processed; if the flow type of the flow to be processed is ARP flow, forwarding the flow to be processed to an ARP flow table; and processing the flow to be processed by using the ARP flow processing command of the ARP flow table.

Optionally, the step of processing the to-be-processed flow by using the ARP flow processing command of the ARP flow table specifically includes: determining the request type of the flow to be processed by using an ARP flow processing command of the ARP flow table; and if the flow to be processed is an ARP request message, responding to the ARP request message according to an address relation mapping table, wherein the address relation mapping table comprises the mapping relation between the MAC address and the IP address.

Optionally, if the traffic to be processed is an ARP request packet, the step of responding to the ARP request packet according to an address relation mapping table specifically includes: if the flow to be processed is an ARP request message, acquiring an IP address to be matched or an MAC address to be matched carried in the flow to be processed; searching a local address relation mapping table according to the IP address to be matched or the MAC address to be matched to obtain target address information; and constructing a response message according to the target address information, and returning the response message to the sending host of the flow to be processed.

Optionally, after the step of determining the request type of the to-be-processed traffic by using the ARP traffic processing command of the ARP flow table, the traffic processing method further includes: if the flow to be processed is an ARP free message, forwarding the flow to be processed to a broadcast flow table; and sending the flow to be processed to a plurality of ports in a broadcast domain according to the broadcast command of the broadcast flow table.

Optionally, after the step of performing traffic classification on the traffic to be processed according to a preset classification rule to obtain a traffic type of the traffic to be processed, the traffic processing method further includes: if the flow type of the flow to be processed is unicast flow, forwarding the flow to be processed to a dynamic learning flow table; according to the processing command of the dynamic learning flow table, matching a first destination address for the flow to be processed by using a local self-learning address table; the self-learning address table is generated through address information received by each port; and sending the flow to be processed to a port corresponding to the first destination address.

Optionally, after the step of matching the to-be-processed traffic with the first destination address by using the local self-learning address table according to the processing command of the dynamic learning flow table, the traffic processing method further includes: if the first destination address of the flow to be processed is not matched, forwarding the flow to be processed to a unicast flow table; according to the unicast command of the unicast flow table, matching a second destination address for the flow to be processed by utilizing a prestored address table; and sending the flow to be processed to a port corresponding to the second destination address.

Optionally, after the step of matching the to-be-processed traffic with the second destination address by using a pre-stored address table according to the unicast command of the unicast flow table, the traffic processing method further includes: if the second destination address of the flow to be processed is not matched, forwarding the flow to be processed to a broadcast flow table; and sending the flow to be processed to a plurality of ports in a broadcast domain according to the broadcast command of the broadcast flow table.

Optionally, after the step of performing traffic classification on the traffic to be processed according to a preset classification rule to obtain a traffic type of the traffic to be processed, the traffic processing method further includes: if the flow type of the flow to be processed is broadcast flow, forwarding the flow to be processed to a broadcast flow table; and sending the flow to be processed to a plurality of ports in a broadcast domain according to the broadcast command of the broadcast flow table.

In order to achieve the above object, the present invention also provides a flow processing apparatus including: the receiving module is used for receiving the flow to be processed; the classification module is used for carrying out flow classification on the flow to be processed according to a preset classification rule to obtain the flow type of the flow to be processed; the forwarding module is used for forwarding the flow to be processed to an ARP flow table if the flow type of the flow to be processed is the ARP flow; and the ARP flow processing module is used for processing the flow to be processed according to the ARP flow processing command of the ARP flow table.

Further, to achieve the above object, the present invention provides a flow rate processing apparatus including: the system comprises a memory, a processor and a flow processing program stored on the memory and capable of running on the processor, wherein the flow processing program realizes the steps of the flow processing method when being executed by the processor.

In order to achieve the above object, the present invention further provides a storage medium having a traffic processing program stored thereon, wherein the traffic processing program, when executed by a processor, implements the steps of the traffic processing method as described above.

The method is applied to a switch, when the switch receives the flow to be processed, the flow to be processed is classified according to a preset classification rule to obtain the flow type of the flow to be processed, when the flow type of the flow to be processed is ARP flow, the flow to be processed is forwarded to an ARP flow table so as to process the flow to be processed locally by utilizing an ARP flow processing command of the ARP flow table, the ARP flow processing is realized locally on the switch by setting the ARP flow table, the ARP request message is not required to be reported to a controller, the flow processing process is simplified, and the resource consumption and the flow processing time are reduced.

Drawings

FIG. 1 is a schematic representation of an operating environment in which embodiments of the present invention are implemented;

fig. 2 is a schematic diagram of a switch fabric of an operating environment according to an embodiment of the present invention;

FIG. 3 is a flow chart illustrating an embodiment of a traffic handling method according to the present invention;

FIG. 4 is a detailed flow chart of step S308 of the embodiment of the flow processing method in FIG. 3;

FIG. 5 is a schematic diagram illustrating a detailed flow of step S404 in the embodiment of the flow processing method in FIG. 4;

FIG. 6 is a flowchart illustrating steps subsequent to step S402 of the embodiment of the flow processing method of FIG. 4;

FIG. 7 is a flowchart illustrating steps subsequent to step S304 in the embodiment of the flow processing method of FIG. 3;

FIG. 8 is a flowchart illustrating steps following step S704 of the embodiment of the flow processing method of FIG. 7;

FIG. 9 is a flowchart illustrating steps following step S804 in the embodiment of the flow processing method of FIG. 8;

FIG. 10 is a flowchart illustrating steps subsequent to step S304 in the embodiment of the flow processing method of FIG. 3;

fig. 11 is a block diagram showing the configuration of a flow processing apparatus according to the present invention.

The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.

Detailed Description

It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

FIG. 1 is a schematic representation of an operating environment in which embodiments of the present invention are directed. The switch 1001 is communicatively connected to the controller 1002. The controller 1002 is responsible for managing all Access Points (APs), including switches, in a wireless network to control traffic to ensure that the traffic flows in order. The switch is responsible for the forwarding work of the lookup table of the network data packet (i.e. the flow table). In the embodiment of the present invention, the switch is an ethernet switch, for example, may be an OVS (openvswitch) switch, and the OVS switch is a Software Defined Network (SDN) switch with stable open source and also supports a conventional network. The switch may be in a virtual form implemented by a virtual machine, or may be in a physical hardware form. The controller may be an SDN controller.

Fig. 2 is a schematic diagram of a switch fabric of an operating environment according to an embodiment of the present invention. The switch may include: a processor 2001 such as a CPU, a network interface 2003, a memory 2004, a communication bus 2002. The communication bus 2002 is used to implement connection communication between these components. The network interface 2003 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 2004 may be a high-speed RAM memory or a non-volatile memory such as a disk memory. The memory 2004 may alternatively be a storage device separate from the processor 2001 described previously.

Those skilled in the art will appreciate that the switch fabric shown in fig. 2 does not constitute a limitation of switches and may include more or fewer components than shown, or a combination of certain components, or a different arrangement of components.

The memory 2004, which is a type of computer storage medium, may include an operating system, a network communication module, and a traffic handling program. The network interface 2003 is mainly used for connecting a background server and performing data communication with the background server; and the processor 2001 may be configured to invoke the traffic handling program stored in the memory 2004 and perform the following operations: receiving flow to be processed; carrying out flow classification on the flow to be processed according to a preset classification rule to obtain the flow type of the flow to be processed; if the flow type of the flow to be processed is ARP flow, forwarding the flow to be processed to an ARP flow table; and processing the flow to be processed by using the ARP flow processing command of the ARP flow table.

Optionally, the step of processing the to-be-processed flow by using the ARP flow processing command of the ARP flow table specifically includes: determining the request type of the flow to be processed by using an ARP flow processing command of the ARP flow table; and if the flow to be processed is an ARP request message, responding to the ARP request message according to an address relation mapping table, wherein the address relation mapping table comprises the mapping relation between the MAC address and the IP address.

Optionally, if the traffic to be processed is an ARP request packet, the step of responding to the ARP request packet according to an address relation mapping table specifically includes: if the flow to be processed is an ARP request message, acquiring an IP address to be matched or an MAC address to be matched carried in the flow to be processed; searching a local address relation mapping table according to the IP address to be matched or the MAC address to be matched to obtain target address information; and constructing a response message according to the target address information, and returning the response message to the sending host of the flow to be processed.

Optionally, after the step of determining the request type of the to-be-processed traffic by using the ARP traffic processing command of the ARP flow table, the traffic processing method further includes: if the flow to be processed is an ARP free message, forwarding the flow to be processed to a broadcast flow table; and sending the flow to be processed to a plurality of ports in a broadcast domain according to the broadcast command of the broadcast flow table.

Optionally, after the step of performing traffic classification on the traffic to be processed according to a preset classification rule to obtain a traffic type of the traffic to be processed, the traffic processing method further includes: if the flow type of the flow to be processed is unicast flow, forwarding the flow to be processed to a dynamic learning flow table; according to the processing command of the dynamic learning flow table, matching a first destination address for the flow to be processed by using a local self-learning address table; the self-learning address table is generated through address information received by each port; and sending the flow to be processed to a port corresponding to the first destination address.

Optionally, after the step of matching the to-be-processed traffic with the first destination address by using the local self-learning address table according to the processing command of the dynamic learning flow table, the traffic processing method further includes: if the first destination address of the flow to be processed is not matched, forwarding the flow to be processed to a unicast flow table; according to the unicast command of the unicast flow table, matching a second destination address for the flow to be processed by utilizing a prestored address table; and sending the flow to be processed to a port corresponding to the second destination address.

Optionally, after the step of matching the to-be-processed traffic with the second destination address by using a pre-stored address table according to the unicast command of the unicast flow table, the traffic processing method further includes: if the second destination address of the flow to be processed is not matched, forwarding the flow to be processed to a broadcast flow table; and sending the flow to be processed to a plurality of ports in a broadcast domain according to the broadcast command of the broadcast flow table.

Optionally, after the step of performing traffic classification on the traffic to be processed according to a preset classification rule to obtain a traffic type of the traffic to be processed, the traffic processing method further includes: if the flow type of the flow to be processed is broadcast flow, forwarding the flow to be processed to a broadcast flow table; and sending the flow to be processed to a plurality of ports in a broadcast domain according to the broadcast command of the broadcast flow table.

Referring to fig. 3, an embodiment of a traffic processing method includes:

step S302, receiving flow to be processed;

the flow to be processed is a network data packet, and the flow to be processed is sent out by a host of the access switch. In the embodiment of the application, the traffic to be processed is divided into a plurality of traffic types according to the broadcast type and the request type. Specifically, ARP traffic, unicast traffic, broadcast traffic, multicast traffic, and the like may be used. The unicast traffic is traffic sent to a designated host, the broadcast traffic is traffic sent to all hosts in a broadcast domain, and the multicast traffic is traffic sent to a plurality of designated hosts. The APR flow is ARP protocol flow. The ARP protocol is mainly responsible for converting 32-bit IP addresses in the lan into corresponding 48-bit physical addresses, i.e. MAC addresses of the network cards, for example, the IP address is 192.168.0.1 the MAC address of the network card is 00-03-0F-FD-1D-2B, and the whole conversion process is that one host first sends a broadcast data packet containing IP address information, i.e. an ARP request, to the target host, and then the target host sends a data packet containing the IP address and the MAC address to the host, and data transmission can be realized by the two hosts through the MAC address.

In this embodiment, the switch may receive traffic sent by each host accessing the switch. And when the exchanger receives the traffic sent by the host, taking the traffic as the traffic to be processed.

Step S304, carrying out flow classification on the flow to be processed according to a preset classification rule to obtain the flow type of the flow to be processed;

the preset classification rule is classified according to the broadcast type or the request type of the flow. After classifying the traffic to be processed, the switch obtains the traffic type of the traffic to be processed.

In one embodiment, the classification processing of the traffic to be processed is performed in a classifier flow table of the switch. When the switch receives the flow to be processed, the flow to be processed is matched into the classifier flow table, so that the flow to be processed is classified by utilizing the flow classification command in the classifier flow table.

Step S306, if the flow type of the flow to be processed is ARP flow, forwarding the flow to be processed to an ARP flow table;

and the switch forwards the flow to be processed to the corresponding flow table according to the flow type of the flow to be processed. In this embodiment, the flow tables corresponding to the ARP flow, the unicast flow, the broadcast flow, and the multicast flow are an ARP flow table, a unicast flow table, a broadcast flow table, and a multicast flow table, respectively. Each flow table contains corresponding processing commands for the corresponding function of the flow. And if the flow to be processed is the ARP flow, the exchanger forwards the flow to be processed to an ARP flow table.

And step S308, processing the flow to be processed by using the ARP flow processing command of the ARP flow table.

ARP traffic handling commands include, but are not limited to, request response to ARP traffic and traffic forwarding.

The ARP traffic includes ARP request messages and ARP free messages. The ARP request message is packaged with an MAC address or an IP address and sent out in a broadcast mode so as to request to acquire a destination IP address corresponding to the packaged MAC address or a destination MAC address corresponding to the packaged IP address. The ARP free message is encapsulated with the IP address of the local machine and is sent out in a broadcasting mode so as to inform other host machines in a broadcasting domain that the IP address is owned by the local machine. And if the ARP flow is the ARP request message, the switch uses the ARP flow processing command of the ARP flow table to request and respond to the ARP request message. If the ARP flow is ARP free message, the interactive machine uses the ARP flow processing command of the ARP flow table to forward the ARP free message. In this embodiment, the switch forwards the ARP free packet to all hosts in the broadcast domain. In other embodiments, the ARP free packet may also be forwarded to one or more designated hosts.

In this embodiment, when the switch receives a flow to be processed, the switch performs flow classification on the flow to be processed according to a preset classification rule to obtain a flow type of the flow to be processed, and when the flow type of the flow to be processed is an ARP flow, the flow to be processed is forwarded to an ARP flow table so as to process the flow to be processed locally by using an ARP flow processing command of the ARP flow table.

Referring to fig. 4, in an embodiment, the step S308 specifically includes:

step S402, determining the request type of the flow to be processed by using the ARP flow processing command of the ARP flow table;

the switch determines the request type of the traffic to be processed, e.g., whether it is an ARP request message or an ARP toll free message. Specifically, the switch analyzes the traffic to be processed by using an ARP traffic processing command of the ARP flow table to determine a request type of the traffic to be processed.

Step S404, if the flow to be processed is an ARP request message, responding to the ARP request message according to an address relation mapping table, wherein the address relation mapping table comprises the mapping relation between the MAC address and the IP address.

The address relation mapping table comprises mapping relations between a plurality of IP addresses and a plurality of MAC addresses. The address mapping table is stored in the switch in advance. When the mapping relation between a certain IP address and MAC is changed, the switch updates the address relation mapping table instantly.

If the flow to be processed is an ARP request message, the exchanger searches an address relation mapping table by executing an ARP flow processing command of an ARP flow table, and acquires a destination address corresponding to an address encapsulated by the ARP flow. The exchanger generates ARP response message with the changed target address, and returns the ARP response message to the sending host of the ARP flow. At this point, the switch completes the response to the ARP request message.

In this embodiment, the switch determines a request type of a to-be-processed flow by using an ARP flow processing command of an ARP flow table, and when the to-be-processed flow is an ARP request message, responds to the ARP request message according to an address relationship mapping table, where the address relationship mapping table includes a mapping relationship between an MAC address and an IP address; the address relation mapping table is preset locally on the switch, and the flow processing command of the ARP flow table is utilized to respond to the address relation mapping table, so that the ARP request message can be directly responded to the switch without requiring external equipment to search for addresses.

Referring to fig. 5, in an embodiment, the step S404 specifically includes:

step S502, if the flow to be processed is an ARP request message, acquiring an IP address to be matched or an MAC address to be matched carried in the flow to be processed;

and if the flow to be processed is the ARP request message, packaging the IP address to be matched or the MAC address to be matched with the flow to be processed. The IP address to be matched is the IP address of the target host, when the local machine sending the ARP request message needs to be in network connection with the target host of the IP address to be matched, the MAC address of the target host also needs to be known, and at the moment, the local machine sends the ARP request message encapsulating the IP address to be matched so as to request to acquire the MAC address of the target host. The MAC address to be matched is all the local machine which sends the ARP request message, when the local machine accesses the network to obtain the IP address, the local machine does not know the IP address of the local machine, and then the ARP request message which is packaged with the local machine MAC address is sent to request to obtain the local machine IP address. After the local computer obtains the IP address, an ARP free message encapsulated with the IP address can be further sent out to inform other hosts in the broadcast domain that the IP address is occupied, so that the IP address is prevented from being invaded by other hosts.

Step S504, according to the IP address to be matched or the MAC address to be matched, searching a local address relation mapping table to obtain target address information;

the switch searches a local address relation mapping table of the switch according to the IP address to be matched or the MAC address to be matched, which are packaged in the flow to be processed, and obtains the information of the target address. And when the flow to be processed is encapsulated with the IP address to be matched, the target address information is the MAC address corresponding to the IP address to be matched, and when the flow to be processed is encapsulated with the MAC address to be matched, the target address information is the IP address corresponding to the MAC address to be matched.

Step S506, constructing a response message according to the target address information, and returning the response message to the sending host of the flow to be processed.

The exchanger constructs a response message, encapsulates the target address information in the response message, and then returns the response message encapsulated with the target address information to the sending host sending the flow to be processed, thereby completing the response to the ARP request message.

The embodiment provides a specific method for responding to the ARP request message locally in the switch, which only needs to search a local address relation mapping table, obtain target address information requested by the ARP request message, construct a response message according to the target address information, return the response message to a sending host of the flow to be processed, and has a simple response process.

Referring to fig. 6, in an embodiment, after step S402, the traffic processing method further includes:

step S602, if the flow to be processed is ARP free message, the flow to be processed is forwarded to a broadcast flow table;

and when the flow to be processed is the ARP free message, the exchanger forwards the flow to be processed to the broadcast flow table.

Step S604, according to the broadcast command of the broadcast flow table, sending the traffic to be processed to a plurality of ports in the broadcast domain.

The switch generates the to-be-processed flow to a plurality of ports in the broadcast domain according to the broadcast command of the broadcast flow table. That is, the switch broadcasts the ARP free packet encapsulated with the IP address to all hosts accessing the switch to notify each host that the IP address is occupied.

In this embodiment, when the traffic to be processed is an ARP free packet, the ARP free packet is forwarded to the broadcast flow table for broadcasting, so that all ARP traffic can be processed.

Referring to fig. 7, in an embodiment, after the step S304, the traffic processing method further includes:

step S702, if the flow type of the flow to be processed is unicast flow, forwarding the flow to be processed to a dynamic learning flow table;

step S704, according to the processing command of the dynamic learning flow table, matching a first destination address for the flow to be processed by using a local self-learning address table; the self-learning address table is generated through address information received by each port;

the switch receives Media Access Control (MAC) address information from all its ports, forms a MAC address table and maintains it. When a switch receives a frame of traffic, it will decide whether to filter or forward the frame of traffic based on its own MAC address table. At this time, the maintained MAC table is the FDB address table. If the destination MAC address of the traffic received by the switch is not in the FDB address table, the traffic is sent to a port corresponding to the MAC address in the FDB address table; if the destination MAC address of the traffic received by the switch is not in the FDB address table, the traffic will be sent to all other ports of the Virtual Local Area Network (VLAN) to which the traffic belongs except the source port. The dynamic learning flow table is used for dynamically learning an FDB address table, and the dynamically learned FDB address table is added into the dynamic learning flow table so that the dynamic learning flow table can perform corresponding forwarding processing on the received flow. The FDB address table added in the dynamic learning flow table in the dynamic learning process is the self-learning address table.

Specifically, the switch matches the to-be-processed traffic with the first destination address by using the self-learning address table obtained by the dynamic learning according to the processing command of the dynamic learning flow table. And when the target MAC address packaged by the traffic to be processed exists in the self-learning address table, acquiring the MAC address as a first destination address. And if the MAC address is not found in the self-learning address table, the first destination address is not matched.

Step S706, sending the traffic to be processed to a port corresponding to the first destination address.

And when the first destination address is matched, the switch sends the to-be-processed traffic to a port corresponding to the first destination address so as to complete the forwarding of the to-be-processed traffic of the specified MAC address.

In this embodiment, when the traffic to be processed is a unicast traffic, the traffic to be processed is sent to the dynamic learning flow table, so as to search for the corresponding first destination address according to the self-learning address table learned by the dynamic learning flow table, forward the traffic to be processed to the port corresponding to the first destination address, and perform matching of the destination MAC address on the traffic to be processed through the self-learning address table learned by the dynamic learning flow table, which is high in reliability.

Referring to fig. 8, in an embodiment, after step S704, the traffic processing method further includes:

step S802, if the first destination address of the flow to be processed is not matched, forwarding the flow to be processed to a unicast flow table;

and if the first destination address is not matched in the dynamic learning table, the switch forwards the flow to be processed to the unicast flow table by using the dynamic learning flow table for further matching.

Step S804, according to the unicast command of the unicast flow table, matching a second destination address for the flow to be processed by using a pre-stored address table;

and the unicast flow table searches whether the MAC address carried by the flow to be processed exists in the pre-stored MAC address table or not according to the pre-stored MAC address table, and if so, the MAC address is used as a second destination address. The pre-stored MAC address table can be customized for a user and is pre-stored in the switch.

Step S806, sending the traffic to be processed to the port corresponding to the second destination address.

And the switch sends the to-be-processed traffic to a port corresponding to the second destination address so as to complete the forwarding of the to-be-processed traffic which is designated as unicast traffic and has the MAC address.

In this embodiment, if the dynamic learning flow table is not matched with the first destination address of the to-be-processed flow, the to-be-processed flow is forwarded to the unicast flow table, so as to perform further address matching on the to-be-processed flow according to a unicast command of the unicast flow table, when the address is matched, the matched address is used as the second destination address, and the to-be-processed flow is forwarded to the port corresponding to the second destination address.

Referring to fig. 9, in an embodiment, after step S804, the traffic processing method further includes:

step S902, if the second destination address of the flow to be processed is not matched, forwarding the flow to be processed to a broadcast flow table;

if the second destination address of the flow to be processed is not matched, a destination host of the MAC address carried by the flow to be processed does not exist in the broadcast domain, unicast of the flow to be processed cannot be completed, and the switch forwards the flow to be processed to the broadcast flow table for further processing.

Step S904, according to the broadcast command of the broadcast flow table, sending the traffic to be processed to a plurality of ports in the broadcast domain.

In this embodiment, when the MAC address of the destination host of the traffic to be processed is not matched, the switch transmits the traffic to be processed to all ports in the broadcast domain by using the broadcast command of the broadcast flow table.

In this embodiment, when the flow to be processed is a unicast flow, if both the dynamic learning flow table and the unicast flow table match the flow to be processed to the destination MAC address, the flow to be processed is forwarded to the broadcast flow table for broadcasting, so that the host in the broadcast domain receives the flow to be processed, and the host receiving the flow to be processed can determine whether the flow to be processed is the flow required by the host itself.

Referring to fig. 10, in an embodiment, after the step S304, the traffic processing method further includes:

step S102, if the flow type of the flow to be processed is broadcast flow, forwarding the flow to be processed to a broadcast flow table;

and when the switch judges the flow to be processed as the broadcast flow by analyzing the broadcast type of the flow to be processed, forwarding the flow to be processed to the broadcast flow table for processing.

And step S104, sending the flow to be processed to a plurality of ports in a broadcast domain according to the broadcast command of the broadcast flow table.

And the switch sends the flow to be processed to all ports in the broadcast domain of the switch according to the broadcast command of the broadcast flow table, so that the broadcast flow is forwarded.

In this embodiment, when the traffic type of the traffic to be processed is broadcast traffic, the traffic to be processed is forwarded to the broadcast flow table for broadcasting, so that processing of multiple types of traffic is realized, and the traffic processing object is more comprehensive.

Further, referring to fig. 11, an embodiment of the present invention further provides a traffic processing apparatus, including:

a receiving module 110, configured to receive a flow to be processed;

the classification module 111 is configured to perform traffic classification on the traffic to be processed according to a preset classification rule, so as to obtain a traffic type of the traffic to be processed;

a forwarding module 112, configured to forward the to-be-processed flow to an ARP flow table when the flow type of the to-be-processed flow is an ARP flow;

and the ARP flow processing module 113 is configured to process the to-be-processed flow according to an ARP flow processing command of the ARP flow table.

In the embodiment, when the flow to be processed is received, the flow to be processed is classified according to the preset classification rule to obtain the flow type of the flow to be processed, when the flow type of the flow to be processed is the ARP flow, the flow to be processed is forwarded to the ARP flow table so as to process the flow to be processed locally by using the ARP flow processing command of the ARP flow table, and by setting the ARP flow table, the ARP flow processing is locally performed on the switch without reporting the ARP request message to the controller, so that the flow processing process is simplified, and the resource consumption and the flow processing time are reduced.

Optionally, the ARP traffic processing module 113 is further configured to determine a request type of the traffic to be processed by using an ARP traffic processing command of the ARP flow table; and if the flow to be processed is an ARP request message, responding to the ARP request message according to an address relation mapping table, wherein the address relation mapping table comprises the mapping relation between the MAC address and the IP address.

Optionally, the ARP traffic processing module 113 is further configured to, if the traffic to be processed is an ARP request packet, obtain an IP address to be matched or an MAC address to be matched, where the IP address to be matched or the MAC address to be matched is carried in the traffic to be processed; searching a local address relation mapping table according to the IP address to be matched or the MAC address to be matched to obtain target address information; and constructing a response message according to the target address information, and returning the response message to the sending host of the flow to be processed.

Optionally, the ARP traffic processing module 113 is further configured to forward the traffic to be processed to a broadcast flow table if the traffic to be processed is an ARP free packet; and sending the flow to be processed to a plurality of ports in a broadcast domain according to the broadcast command of the broadcast flow table.

Optionally, the traffic processing apparatus further includes a unicast traffic processing module, configured to forward the traffic to be processed to a dynamic learning flow table if the traffic type of the traffic to be processed is a unicast traffic; according to the processing command of the dynamic learning flow table, matching a first destination address for the flow to be processed by using a local self-learning address table; the self-learning address table is generated through address information received by each port; and sending the flow to be processed to a port corresponding to the first destination address.

Optionally, the unicast traffic processing module is further configured to forward the to-be-processed traffic to a unicast flow table if the first destination address of the to-be-processed traffic is not matched; according to the unicast command of the unicast flow table, matching a second destination address for the flow to be processed by utilizing a prestored address table; and sending the flow to be processed to a port corresponding to the second destination address.

Optionally, the unicast traffic processing module is further configured to forward the to-be-processed traffic to a broadcast flow table if the second destination address of the to-be-processed traffic is not matched; and sending the flow to be processed to a plurality of ports in a broadcast domain according to the broadcast command of the broadcast flow table.

Optionally, the traffic processing apparatus further includes a broadcast traffic processing module, configured to forward the traffic to be processed to a broadcast flow table if the traffic type of the traffic to be processed is broadcast traffic; and sending the flow to be processed to a plurality of ports in a broadcast domain according to the broadcast command of the broadcast flow table.

In addition, an embodiment of the present invention further provides a traffic processing apparatus, where the traffic processing apparatus includes: memory, a processor and a traffic handling program stored on the memory and executable on the processor, the traffic handling program when executed by the processor implementing the steps of the traffic handling method embodiments as described above.

Furthermore, an embodiment of the present invention further provides a storage medium, where a traffic processing program is stored, and the traffic processing program, when executed by a processor, implements the steps of the traffic processing method embodiment as described above.

It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.

The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.

Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.

The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

17页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种流量分配方法和装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!