WO2016058429A1 - Processing method and device for unicast data package - Google Patents

Processing method and device for unicast data package Download PDF

Info

Publication number
WO2016058429A1
WO2016058429A1 PCT/CN2015/084951 CN2015084951W WO2016058429A1 WO 2016058429 A1 WO2016058429 A1 WO 2016058429A1 CN 2015084951 W CN2015084951 W CN 2015084951W WO 2016058429 A1 WO2016058429 A1 WO 2016058429A1
Authority
WO
WIPO (PCT)
Prior art keywords
time
unicast
data packet
destination
host
Prior art date
Application number
PCT/CN2015/084951
Other languages
French (fr)
Chinese (zh)
Inventor
黄金虎
张海
何鹏
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016058429A1 publication Critical patent/WO2016058429A1/en

Links

Images

Definitions

  • the present invention relates to the field of mobile communications, and in particular, to a method and an apparatus for processing a unicast data packet.
  • the switch floods out from each port.
  • Unknown unicast that is, the entry corresponding to the destination MAC of the unicast frame in the MAC forwarding table of the switch. Therefore, when the switch receives the unknown unicast data packet from a certain port, the switch floods all the ports except the receiving port, which is the unicast flooding of the switch. If the switch has not learned the destination MAC, it will continue to flood the packet for this destination MAC for this MAC. In this abnormal situation, continuous flooding consumes network bandwidth, affects network patency, and consumes the network card, CPU (Central Processing Unit), and other comprehensive performance resources of the terminal, resulting in slow or even stuck operation of the terminal.
  • CPU Central Processing Unit
  • the embodiment of the present invention provides a method and a device for processing a unicast data packet, which are used to solve the above technical problem.
  • an embodiment of the present invention provides a method for processing a unicast data packet, where the method includes: monitoring whether a network card receives a unicast data packet that does not belong to itself; After the data packet is broadcast, the destination IP address of the unicast data packet is parsed; the request packet is sent to the host to which the destination IP belongs; wherein the request packet is used to request the corresponding destination host in the unicast data packet.
  • MAC address feedback includes: monitoring whether a network card receives a unicast data packet that does not belong to itself; After the data packet is broadcast, the destination IP address of the unicast data packet is parsed; the request packet is sent to the host to which the destination IP belongs; wherein the request packet is used to request the corresponding destination host in the unicast data packet.
  • the method further includes: establishing a unicast flooding data set to be cleaned, wherein the unicast flooding data set to be cleaned is recorded Destination MAC.
  • the sending the request message to the host to which the destination IP belongs includes: after the first time the request packet is sent to the host to which the destination IP belongs, the first condition is met: the current time-request message sending time is ⁇ the first preset time; The sending time of the request message is the time when the request message is sent to the host for the previous time; if yes, the request message is resent to the host; if not, the real-time monitoring continues to meet the first condition.
  • the method further includes: determining the unicast flood data set to be cleaned, and recording the destination MAC of the host.
  • the sending the request message to the host to which the destination IP belongs includes: real-time monitoring whether the second condition is met: the current time-unicast data packet receiving time ⁇ the second preset time; wherein the unicast data packet receiving time The time when the NIC received the unicast data packet the previous time; if yes, the destination MAC address corresponding to the unicast data packet is cleared from the unicast flooding data set to be cleaned; if not, Continue to monitor in real time whether the second condition is met.
  • an embodiment of the present invention further provides a processing apparatus for a unicast data packet, where the apparatus includes: a data packet monitoring module, configured to monitor whether the network card receives unicast data that is not his own. a packet parsing module, configured to parse the destination IP address of the unicast data packet after receiving the unicast data packet, and set the packet sending module to send a request packet to the host to which the destination IP belongs; The request message is used to request MAC address feedback for the corresponding destination host in the unicast data packet.
  • the device further includes: a data set establishing module, configured to: before monitoring whether the network card receives the unicast data packet that is not owned by itself, establishing a unicast flooding data set to be cleaned; wherein the to-be-cleaned list
  • the broadcast flood data centrally records the destination MAC.
  • the packet sending module includes: a first condition determining unit, configured to monitor whether the first condition is met after the first time the request packet is sent to the host to which the destination IP belongs: the current time-request message sending time ⁇ a preset time; wherein the request message sending time is a time when the request message is sent to the host for the previous time; the first processing unit is configured to resend the message to the host if the determination result is yes Requesting a message; if the judgment result is no, continuing to monitor in real time whether the first condition is satisfied.
  • a first condition determining unit configured to monitor whether the first condition is met after the first time the request packet is sent to the host to which the destination IP belongs: the current time-request message sending time ⁇ a preset time; wherein the request message sending time is a time when the request message is sent to the host for the previous time; the first processing unit is configured to resend the message to the host if the determination result is yes Requesting a message; if the judgment result is no, continuing to monitor in
  • the message sending module further includes:
  • the record determining unit is configured to determine, in the real-time monitoring, whether the first condition is that the first condition determining unit meets the first condition, the unicast flooding data set to be cleaned, and record the destination MAC of the host.
  • the message sending module further includes: a second condition determining unit configured to monitor whether the second condition is met in real time: the current time-unicast data packet receiving time ⁇ the second preset time; wherein the single time The broadcast packet receiving time is the time when the network card receives the unicast data packet the previous time; the second processing unit is configured to set the destination MAC corresponding to the unicast data packet if the determination result is yes. And clearing from the unicast flood data set to be cleaned; if the judgment result is no, continuing to monitor whether the second condition is met in real time.
  • a second condition determining unit configured to monitor whether the second condition is met in real time: the current time-unicast data packet receiving time ⁇ the second preset time; wherein the single time The broadcast packet receiving time is the time when the network card receives the unicast data packet the previous time; the second processing unit is configured to set the destination MAC corresponding to the unicast data packet if the determination result is yes. And clearing from the unicast flood data set to be cleaned; if
  • the purpose of the embodiment of the present invention is to provide a method for eliminating unicast flooding in a local area network by using an IP terminal, and automatically detecting, in an IP terminal, whether the network card of the terminal receives a unicast data packet of a network card other than the IP terminal in real time. Then, the destination IP address of the unicast data packet is parsed, and then an ARP request packet or a ping packet is sent to the host to which the destination IP belongs. In this way, the host to which the destination IP belongs will reply to the arp request packet or the ping packet, and the reply packets will pass through the switch in the network, so that the switches learn the MAC of the host to which the IP belongs, and join the MAC to the switch.
  • the MAC forwarding table eliminates the flooding of unicast packets of the destination MAC by each switch in the network.
  • FIG. 1 is a flowchart of a method for processing a unicast data packet according to an embodiment of the present invention
  • Embodiment 3 is a flowchart of a technical solution according to Embodiment 2 of the present invention.
  • FIG. 4 is a block diagram showing the structure of a processing apparatus for a unicast data packet according to an embodiment of the present invention.
  • the embodiment of the present invention provides a method and an apparatus for processing a unicast data packet, and the following describes the embodiment of the present invention with reference to the accompanying drawings and embodiments. Further details. It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
  • This embodiment provides a method for processing a unicast data packet, which can be implemented on the terminal side, such as a personal computer (PC), a personal tablet computer, an IP set top box, an intelligent IP set top box, and the like.
  • a method for processing a unicast data packet which can be implemented on the terminal side, such as a personal computer (PC), a personal tablet computer, an IP set top box, an intelligent IP set top box, and the like.
  • the method includes the following steps (step S102 - step S106):
  • Step S102 monitoring whether the network card receives a unicast data packet that is not its own (a unicast data packet that is not the local network card);
  • Step S104 after monitoring the receipt of the unicast data packet, parsing the destination IP of the unicast data packet;
  • Step S106 sending a request message (for example, an ARP request message or a ping message, or other message that may cause the host to which the destination IP belongs to respond) to the host to which the destination IP belongs; wherein the request message is used to request the foregoing
  • a request message for example, an ARP request message or a ping message, or other message that may cause the host to which the destination IP belongs to respond
  • the request message is used to request the foregoing
  • the corresponding destination host in the unicast packet performs MAC address feedback.
  • the problem that the unicast packet flooding adversely affects the network in the related art is effectively solved, thereby effectively eliminating the unicast packet flooding of the destination MAC by each switch in the network.
  • the embodiment in order to facilitate the recording of the destination MAC, the embodiment provides a preferred implementation manner, that is, before monitoring whether the network card receives a unicast data packet that does not belong to itself, the method further includes: establishing a unicast pan to be cleaned up. a flood data set; wherein the unicast flood data to be cleaned records the destination MAC.
  • unicast flooding data set to be cleaned there may be various forms, for example, it may be embodied in the form of a unicast flooding linked list to be cleaned, or may be an array, a stack, a collection, a hash table, or the like.
  • sending the request message to the host to which the destination IP belongs includes the following preferred implementation manners:
  • the first condition is met: the current time-request packet sending time ⁇ the first preset time; wherein the request packet sending time is sent to the host the previous time. The time when the message is requested; if yes, the request message is resent to the host; if not, the real-time monitoring continues to monitor whether the first condition is met.
  • the method further includes: determining the unicast flood data set to be cleaned, and recording the destination MAC of the host.
  • sending the request message to the host to which the destination IP belongs further includes the following preferred implementation manners:
  • the real-time monitoring whether the second condition is met the current time-unicast data packet receiving time ⁇ the second preset time; wherein the unicast data packet receiving time is the time when the network card receives the unicast data packet the previous time; And clearing the destination MAC corresponding to the unicast data packet from the unicast flood data set to be cleaned; if not, continuing to monitor whether the second condition is met in real time.
  • the first preset time and the second preset time may be set according to actual conditions.
  • Embodiment 1 Eliminate the corresponding unicast flood by sending an ARP request packet
  • the embodiment provides a method for eliminating unicast flooding in a local area network by using an IP terminal: after the IP terminal detects that the NIC receives a unicast data packet that does not belong to itself, parses the destination IP address of the unicast data packet, and the purpose is The host to which the IP belongs sends an ARP Request packet. In this way, after receiving the ARP request packet, the host to which the destination IP belongs will reply to the ARP request, so that the switches learn the MAC of the host to which the IP belongs, and add the MAC to the MAC forwarding table of the switch, thereby eliminating the network. Each switch in the road floods the unicast packet of the destination MAC.
  • a “unicast flooding linked list to be cleaned up” is maintained, and each detected non-native flooding unicast packet information is organized into an entry and saved in a linked list (using the destination MAC as a table).
  • the item is uniquely marked.
  • the entry information includes the destination MAC address, the destination IP address, the last unicast data packet received by the destination MAC address, and the ARP request packet transmission time.
  • the re-sending ARP interval T1 is used to control the interval for sending ARP request packets of each entry.
  • the aging time of the unicast flooding entry is aging and the entry is deleted.
  • FIG. 2 is a flowchart of a technical solution according to Embodiment 1 of the present invention. As shown in FIG. 2, the process includes:
  • Step 201 Create and initialize a "unicast flooding linked list to be cleaned up".
  • Step 202 Start a sub-thread of "to-be-cleaned unicast flooding list".
  • the sub-thread is used to re-send the ARP request packet of the unicast flooding list to be cleared and delete the aging of the entry. This sub-thread is described later.
  • Step 203 Dynamically monitor whether the network card receives the unicast data packet that is not the local network card. If yes, go to step 204; if not, continue with step 203.
  • Step 204 Parse the received destination MAC address of the non-local network card unicast data packet.
  • Step 205 Determine whether the unicast flooding list to be cleaned has an entry corresponding to the destination MAC. If yes, go to step 205a; if not, go to step 206.
  • Step 205a Update the "reception time of the last received MAC unicast data packet" of the destination MAC corresponding entry to the current time, and then proceed to step 203 to continue detecting the new situation.
  • Step 206 Record the destination MAC entry to the "unicast flooding linked list to be cleaned up".
  • Step 207 Parse the received destination IP address of the non-local network card unicast data packet, and update the destination IP address of the corresponding entry.
  • Step 208 Send an ARP request packet to the host to which the destination IP belongs.
  • Step 209 Update the ARP request sending time of the destination MAC corresponding entry to the current time. Then proceed to step 203 to continue detecting the new situation.
  • the steps of the sub-thread of the "unicast flooding linked list to be cleaned up" initiated by the above step 202 are as follows:
  • Step 2101 Initialize the retransmission ARP interval T1, and initialize the entry aging time T2, generally T2>2T1.
  • Step 2102 Whether the unicast flooding linked list to be cleaned item is empty. If it is empty, proceed to step 2102; if not, go to step 2103.
  • Step 2103 Detect whether each entry needs to resend the ARP request packet: if the "current time” minus the entry "APR request sending time” is greater than or equal to T1, resend the ARP request packet of the entry, and Update the APR Request Send Time of this entry to the current time.
  • Step 2104 Check whether the aging time of each entry has arrived. If it has arrived, clear the corresponding entry. That is, if the "current time” minus the entry "the last time the receiving time of the MAC unicast packet received this destination" is greater than or equal to T2, the entry is cleared. Then proceed to step 2102.
  • Embodiment 2 Eliminating the corresponding unicast flooding by sending a ping request packet
  • the embodiment provides a method for eliminating unicast flooding in a local area network by using an IP terminal: after the IP terminal detects that the NIC receives a unicast data packet that does not belong to itself, parses the destination IP address of the unicast data packet, and the purpose is The host to which the IP belongs sends a ping request packet. In this way, after receiving the ping request packet, the host to which the destination IP belongs will reply to the ping request, so that the switches learn the MAC of the host to which the IP belongs, and add the MAC to the MAC forwarding table of the switch, thereby eliminating the network. Each switch in the road floods the unicast packet of the destination MAC.
  • a “unicast flooding linked list to be cleaned up” is maintained, and each detected non-native flooding unicast packet information is organized into an entry and saved in a linked list (using the destination MAC as a table).
  • the item is uniquely marked.
  • the entry information includes the destination MAC address, the destination IP address, the last unicast data packet received by the destination MAC address, and the ping request packet transmission time.
  • the ping request interval is set to aging the ping request packet of each entry.
  • the aging time of the unicast flooding entry is aging and the entry is deleted.
  • FIG. 3 is a flowchart of a technical solution according to Embodiment 2 of the present invention. As shown in FIG. 3, the process includes:
  • Step 301 Create and initialize a "unicast flooding linked list to be cleaned up".
  • Step 302 Start the "unilateral flooding linked list to be cleaned up" sub-thread.
  • the sub-thread is used to re-send the ping request packet and delete the aging of the unicast flooding list. This sub-thread is described later.
  • Step 303 Dynamically monitor whether the network card receives the unicast data packet that is not the local network card. If yes, go to step 304; if not, continue with step 303.
  • Step 304 Parse the received destination MAC address of the non-local network card unicast data packet.
  • Step 305 Determine whether the unicast flooding list to be cleaned has an entry corresponding to the destination MAC. If yes, go to step 305a; if not, go to step 306.
  • Step 305a Update the "reception time of the last received MAC unicast data packet" of the destination MAC corresponding entry to the current time, and then proceed to step 303 to continue detecting the new situation.
  • Step 306 Record the destination MAC entry to the "unicast flooding linked list to be cleaned up".
  • Step 307 Parse the received destination IP address of the non-local network card unicast data packet, and update the destination IP address of the corresponding entry.
  • Step 308 Send a ping request packet to the host to which the destination IP belongs.
  • Step 309 Update the ping request sending time of the destination MAC corresponding entry to the current time. Then proceed to step 203 to continue detecting the new situation.
  • steps of the sub-thread of the "unicast flooding linked list to be cleaned up" initiated by the above step 302 are as follows:
  • Step 3101 Initialize the retransmission ARP interval T1, and initialize the entry aging time T2, generally T2>2T1.
  • Step 3102 Whether the item of the unicast flooding linked list to be cleaned is empty. If it is empty, proceed to step 3102; if not, go to step 3103.
  • Step 3103 Detect whether each entry needs to resend the ping request packet: if the current time minus the ping request sending time is greater than or equal to T1, the ping request packet of the entry is resent, and Update the "ping request send time" of this entry to the current time.
  • Step 3104 Detect whether the aging time of each entry has arrived. If yes, clear the corresponding entry. That is, if the "current time” minus the entry "the last time the receiving time of the MAC unicast packet received this destination" is greater than or equal to T2, the entry is cleared. Then proceed to step 3102.
  • the above description is only a preferred embodiment of the present invention. It is detected by different methods whether a non-native unicast data packet is received by the local device, and the host belongs to the host that receives the non-native unicast data packet destination. Sending other messages except the ARP request message and the ping message that may cause the "received host of the non-native unicast data packet destination host" to respond, or indirectly causing the "received non-native device"
  • the unicast data packet destination IP belongs to the host, and the method for sending the ARP request packet and the ping packet can implement the technical solution of the present invention.
  • FIG. 4 is a structural block diagram of a processing apparatus for a unicast data packet according to an embodiment of the present invention. As shown in FIG. 4, the apparatus includes: a data packet monitoring module 10, an IP parsing module 20, and a message sending module 30. The structure is described in detail below.
  • the data packet monitoring module 10 is configured to monitor whether the network card receives a unicast data packet that does not belong to itself;
  • the IP parsing module 20 is configured to parse the destination IP of the unicast data packet after monitoring the receiving the unicast data packet;
  • the message sending module 30 is configured to send a request message to the host to which the destination IP belongs.
  • the request message is used to request MAC address feedback for the corresponding destination host in the unicast data packet.
  • the embodiment in order to facilitate the recording of the destination MAC, the embodiment provides a preferred implementation manner, that is, the apparatus further includes: a data set establishing module, configured to monitor whether the network card receives unicast data that is not its own. Before the packet, the unicast flood data set to be cleaned is set up; wherein the destination unicast flood data is to be recorded in the centralized MAC address.
  • a data set establishing module configured to monitor whether the network card receives unicast data that is not its own. Before the packet, the unicast flood data set to be cleaned is set up; wherein the destination unicast flood data is to be recorded in the centralized MAC address.
  • the message sending module 30 includes: a first condition determining unit, configured to monitor whether the first condition is met after the first time the request packet is sent to the host to which the destination IP belongs: the current time-request message sending time ⁇ a first preset time; wherein the request message sending time is a time when the request message is sent to the host for the previous time; the first processing unit is configured to resend the host to the host if the judgment result is yes The request message is sent; if the judgment result is no, the real-time monitoring continues to monitor whether the first condition is satisfied.
  • a first condition determining unit configured to monitor whether the first condition is met after the first time the request packet is sent to the host to which the destination IP belongs: the current time-request message sending time ⁇ a first preset time; wherein the request message sending time is a time when the request message is sent to the host for the previous time; the first processing unit is configured to resend the host to the host if the judgment result is yes The request message is sent; if the judgment result is no
  • the message sending module 30 further includes: a record determining unit, configured to determine, in the real-time monitoring, whether the first condition determining unit meets the first condition, determining the unicast flooding data set to be cleaned, and recording The destination MAC of the host.
  • the message sending module 30 further includes: a second condition determining unit configured to monitor whether the second condition is met in real time: the current time-unicast data packet receiving time ⁇ the second preset time; wherein the unicast data packet The receiving time is the time when the NIC received the unicast data packet the previous time; the second processing unit is configured to: if the determination result is yes, the destination MAC corresponding to the unicast data packet, from the The unicast flood data to be cleaned is cleared; if the judgment result is no, the real-time monitoring continues to monitor whether the second condition is satisfied.
  • a second condition determining unit configured to monitor whether the second condition is met in real time: the current time-unicast data packet receiving time ⁇ the second preset time; wherein the unicast data packet The receiving time is the time when the NIC received the unicast data packet the previous time; the second processing unit is configured to: if the determination result is yes, the destination MAC corresponding to the unicast data packet, from the The unicast flood data to be cleaned
  • the embodiment of the present invention automatically detects whether the network card receives the unicast data packet whose destination MAC address is not the MAC address of the local network card, and if received, parses the destination IP address of the unicast data packet, and then sends an arp request to the host to which the destination IP belongs. Packet, or ping message, etc. In this way, the host to which the destination IP belongs will reply to the arp request message or reply. Ping packets, these replies will pass through the switches in the network, so that the switches learn the MAC of the host to which the IP belongs, and add the MAC to the MAC forwarding table of the switch, thereby eliminating the MACs of the switches in the network.
  • the unicast package is flooded.
  • the host to which the destination IP belongs will reply to the arp request packet or the reply ping packet, and the reply packets will pass through the switch in the network, so that the switches learn the IP address.
  • the MAC address of the host is added to the MAC forwarding table of the switch, thereby eliminating the flooding of the unicast packets of the destination MAC by each switch in the network.

Abstract

Disclosed are a processing method and device for a unicast data package. The method comprises: monitoring whether a network card receives a unicast data package which does not belong thereto; after it is monitored that the unicast data package is received, parsing out a destination IP of the unicast data package; and sending a request packet to a host to which the destination IP belongs, wherein the request packet is used for requesting feedback of a MAC address for a corresponding destination host in the unicast data package. By means of the present invention, the problem in the related art of the harmful effect on a network due to unicast package flooding is effectively solved, so as to effectively eliminate the unicast package flooding on the destination MAC by various switches in the network.

Description

一种单播数据包的处理方法及装置Method and device for processing unicast data packet 技术领域Technical field
本发明涉及移动通讯领域,特别是涉及一种单播数据包的处理方法及装置。The present invention relates to the field of mobile communications, and in particular, to a method and an apparatus for processing a unicast data packet.
背景技术Background technique
在以太局域网中,对于未知单播,交换机会从各个端口泛洪出去。未知单播,即交换机的MAC转发表中没有该单播帧的目的MAC对应的条目。从而,当交换机从某个端口收取到这种未知单播数据包时,交换机就会从除收取端口外的所有端口泛洪转发出去,这就是交换机的单播泛洪。如果交换机一直未学习到该目的MAC,则会一直对此目的MAC为此MAC的数据包持续泛洪。在此异常情况下,持续泛洪会消耗网路带宽,影响网络通畅性,同时消耗终端的网卡、CPU(Central Processing Unit,中央处理器)等以及综合性能资源,造成终端操作慢甚至卡死。In an Ethernet LAN, for unknown unicast, the switch floods out from each port. Unknown unicast, that is, the entry corresponding to the destination MAC of the unicast frame in the MAC forwarding table of the switch. Therefore, when the switch receives the unknown unicast data packet from a certain port, the switch floods all the ports except the receiving port, which is the unicast flooding of the switch. If the switch has not learned the destination MAC, it will continue to flood the packet for this destination MAC for this MAC. In this abnormal situation, continuous flooding consumes network bandwidth, affects network patency, and consumes the network card, CPU (Central Processing Unit), and other comprehensive performance resources of the terminal, resulting in slow or even stuck operation of the terminal.
针对相关技术中单播包泛洪对网络的不良影响的问题,目前尚未提出有效的解决方案。In view of the problem that the unicast packet flooding has adverse effects on the network in the related art, an effective solution has not been proposed yet.
发明内容Summary of the invention
针对相关技术中单播包泛洪对网络的不良影响的问题,本发明实施例提供了一种单播数据包的处理方法及装置,用以解决上述技术问题。For the problem that the unicast packet flooding has a bad influence on the network in the related art, the embodiment of the present invention provides a method and a device for processing a unicast data packet, which are used to solve the above technical problem.
根据本发明的一个方面,本发明实施例提供了一种单播数据包的处理方法,其中,该方法包括:监测网卡是否收到不属于自己的单播数据包;在监测收到所述单播数据包后,解析出所述单播数据包的目的IP;向目的IP所属主机发送请求报文;其中,所述请求报文用于要求对所述单播数据包中对应的目的主机进行MAC地址反馈。According to an aspect of the present invention, an embodiment of the present invention provides a method for processing a unicast data packet, where the method includes: monitoring whether a network card receives a unicast data packet that does not belong to itself; After the data packet is broadcast, the destination IP address of the unicast data packet is parsed; the request packet is sent to the host to which the destination IP belongs; wherein the request packet is used to request the corresponding destination host in the unicast data packet. MAC address feedback.
可选地,监测网卡是否收到不属于自己的单播数据包之前,所述方法还包括:建立待清理单播泛洪数据集;其中,所述待清理单播泛洪数据集中记录所述目的MAC。Optionally, the method further includes: establishing a unicast flooding data set to be cleaned, wherein the unicast flooding data set to be cleaned is recorded Destination MAC.
可选地,向目的IP所属主机发送请求报文包括:向目的IP所属主机首次发送请求报文之后,实时监测是否满足第一条件:当前时间-请求报文发送时间≥第一预设时间;其中,所述请求报文发送时间为前一次向该主机发送请求报文的时间;如果是,则向该主机重发所述请求报文;如果否,则继续实时监测是否满足所述第一条件。 Optionally, the sending the request message to the host to which the destination IP belongs includes: after the first time the request packet is sent to the host to which the destination IP belongs, the first condition is met: the current time-request message sending time is ≥ the first preset time; The sending time of the request message is the time when the request message is sent to the host for the previous time; if yes, the request message is resent to the host; if not, the real-time monitoring continues to meet the first condition.
可选地,实时监测是否满足所述第一条件之前,所述方法还包括:确定所述待清理单播泛洪数据集中,记录有所述主机的目的MAC。Optionally, before the real-time monitoring whether the first condition is met, the method further includes: determining the unicast flood data set to be cleaned, and recording the destination MAC of the host.
可选地,向目的IP所属主机发送请求报文还包括:实时监测是否满足第二条件:当前时间-单播数据包接收时间≥第二预设时间;其中,所述单播数据包接收时间为所述网卡前一次接收到所述单播数据包的时间;如果是,则将所述单播数据包对应的目的MAC,从所述待清理单播泛洪数据集中清除;如果否,则继续实时监测是否满足所述第二条件。Optionally, the sending the request message to the host to which the destination IP belongs includes: real-time monitoring whether the second condition is met: the current time-unicast data packet receiving time ≥ the second preset time; wherein the unicast data packet receiving time The time when the NIC received the unicast data packet the previous time; if yes, the destination MAC address corresponding to the unicast data packet is cleared from the unicast flooding data set to be cleaned; if not, Continue to monitor in real time whether the second condition is met.
根据本发明的另一方面,本发明实施例还提供了一种单播数据包的处理装置,其中,该装置包括:数据包监测模块,设置为监测网卡是否收到不属于自己的单播数据包;IP解析模块,设置为在监测收到所述单播数据包后,解析出所述单播数据包的目的IP;报文发送模块,设置为向目的IP所属主机发送请求报文;其中,所述请求报文用于要求对所述单播数据包中对应的目的主机进行MAC地址反馈。According to another aspect of the present invention, an embodiment of the present invention further provides a processing apparatus for a unicast data packet, where the apparatus includes: a data packet monitoring module, configured to monitor whether the network card receives unicast data that is not his own. a packet parsing module, configured to parse the destination IP address of the unicast data packet after receiving the unicast data packet, and set the packet sending module to send a request packet to the host to which the destination IP belongs; The request message is used to request MAC address feedback for the corresponding destination host in the unicast data packet.
可选地,所述装置还包括:数据集建立模块,设置为在监测网卡是否收到不属于自己的单播数据包之前,建立待清理单播泛洪数据集;其中,所述待清理单播泛洪数据集中记录所述目的MAC。Optionally, the device further includes: a data set establishing module, configured to: before monitoring whether the network card receives the unicast data packet that is not owned by itself, establishing a unicast flooding data set to be cleaned; wherein the to-be-cleaned list The broadcast flood data centrally records the destination MAC.
可选地,所述报文发送模块包括:第一条件判断单元,设置为向目的IP所属主机首次发送请求报文之后,实时监测是否满足第一条件:当前时间-请求报文发送时间≥第一预设时间;其中,所述请求报文发送时间为前一次向该主机发送请求报文的时间;第一处理单元,设置为在判断结果为是的情况下,向该主机重发所述请求报文;在判断结果为否的情况下,继续实时监测是否满足所述第一条件。Optionally, the packet sending module includes: a first condition determining unit, configured to monitor whether the first condition is met after the first time the request packet is sent to the host to which the destination IP belongs: the current time-request message sending time ≥ a preset time; wherein the request message sending time is a time when the request message is sent to the host for the previous time; the first processing unit is configured to resend the message to the host if the determination result is yes Requesting a message; if the judgment result is no, continuing to monitor in real time whether the first condition is satisfied.
可选地,所述报文发送模块还包括:Optionally, the message sending module further includes:
记录确定单元,设置为在所述第一条件判断单元实时监测是否满足所述第一条件之前,确定所述待清理单播泛洪数据集中,记录有所述主机的目的MAC。The record determining unit is configured to determine, in the real-time monitoring, whether the first condition is that the first condition determining unit meets the first condition, the unicast flooding data set to be cleaned, and record the destination MAC of the host.
可选地,所述报文发送模块还包括:第二条件判断单元,设置为实时监测是否满足第二条件:当前时间-单播数据包接收时间≥第二预设时间;其中,所述单播数据包接收时间为所述网卡前一次接收到所述单播数据包的时间;第二处理单元,设置为在判断结果为是的情况下,将所述单播数据包对应的目的MAC,从所述待清理单播泛洪数据集中清除;在判断结果为否的情况下,继续实时监测是否满足所述第二条件。 Optionally, the message sending module further includes: a second condition determining unit configured to monitor whether the second condition is met in real time: the current time-unicast data packet receiving time ≥ the second preset time; wherein the single time The broadcast packet receiving time is the time when the network card receives the unicast data packet the previous time; the second processing unit is configured to set the destination MAC corresponding to the unicast data packet if the determination result is yes. And clearing from the unicast flood data set to be cleaned; if the judgment result is no, continuing to monitor whether the second condition is met in real time.
本发明实施例的目的在于:提供一种通过IP终端消除局域网内单播泛洪的方法,在IP终端实时自动检测该终端的网卡是否收到非本IP终端网卡的单播数据包,如果收到,则解析出该单播数据包的目的IP,然后向该目的IP所属主机发送ARP请求报文、或者ping报文等。这样,该目的IP所属主机就会回复arp请求报文或回复ping报文,这些回复报文就会通过网络中的交换机,使这些交换机学习到该IP所属主机的MAC,并将该MAC加入交换机的MAC转发表,从而消除网路中各交换机对该目的MAC的单播包泛洪。The purpose of the embodiment of the present invention is to provide a method for eliminating unicast flooding in a local area network by using an IP terminal, and automatically detecting, in an IP terminal, whether the network card of the terminal receives a unicast data packet of a network card other than the IP terminal in real time. Then, the destination IP address of the unicast data packet is parsed, and then an ARP request packet or a ping packet is sent to the host to which the destination IP belongs. In this way, the host to which the destination IP belongs will reply to the arp request packet or the ping packet, and the reply packets will pass through the switch in the network, so that the switches learn the MAC of the host to which the IP belongs, and join the MAC to the switch. The MAC forwarding table eliminates the flooding of unicast packets of the destination MAC by each switch in the network.
上述说明仅是本发明实施例技术方案的概述,为了能够更清楚了解本发明实施例的技术手段,而可依照说明书的内容予以实施,并且为了让本发明实施例的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solutions of the embodiments of the present invention, and the technical means of the embodiments of the present invention can be more clearly understood, and can be implemented according to the contents of the specification, and the above and other objects, features and features of the embodiments of the present invention are Advantages will be more apparent and obvious, and specific embodiments of the invention are set forth below.
附图说明DRAWINGS
图1是根据本发明实施例的单播数据包的处理方法流程图;1 is a flowchart of a method for processing a unicast data packet according to an embodiment of the present invention;
图2是根据本发明实施例一的技术方案流程图;2 is a flowchart of a technical solution according to Embodiment 1 of the present invention;
图3是根据本发明实施例二的技术方案流程图;3 is a flowchart of a technical solution according to Embodiment 2 of the present invention;
图4是根据本发明实施例的单播数据包的处理装置的结构框图。4 is a block diagram showing the structure of a processing apparatus for a unicast data packet according to an embodiment of the present invention.
具体实施方式detailed description
为了解决现有技术中单播包泛洪对网络的不良影响的问题,本发明实施例提供了一种单播数据包的处理方法及装置,以下结合附图以及实施例,对本发明实施例进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不限定本发明。In order to solve the problem that the unicast packet flooding has a bad influence on the network in the prior art, the embodiment of the present invention provides a method and an apparatus for processing a unicast data packet, and the following describes the embodiment of the present invention with reference to the accompanying drawings and embodiments. Further details. It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
本实施例提供了一种单播数据包的处理方法,该方法可以在终端侧实现,例如个人电脑(PC)、个人平板电脑、IP机顶盒、智能IP机顶盒等等。图1是根据本发明实施例的单播数据包的处理方法流程图,如图1所示,该方法包括以下步骤(步骤S102-步骤S106):This embodiment provides a method for processing a unicast data packet, which can be implemented on the terminal side, such as a personal computer (PC), a personal tablet computer, an IP set top box, an intelligent IP set top box, and the like. 1 is a flowchart of a method for processing a unicast data packet according to an embodiment of the present invention. As shown in FIG. 1, the method includes the following steps (step S102 - step S106):
步骤S102,监测网卡是否收到不属于自己的单播数据包(非本网卡的单播数据包);Step S102, monitoring whether the network card receives a unicast data packet that is not its own (a unicast data packet that is not the local network card);
步骤S104,在监测收到上述单播数据包后,解析出上述单播数据包的目的IP; Step S104, after monitoring the receipt of the unicast data packet, parsing the destination IP of the unicast data packet;
步骤S106,向目的IP所属主机发送请求报文(例如ARP请求报文或者ping报文,或者其他可引起该目的IP所属主机响应答复的报文);其中,该请求报文用于要求对上述单播数据包中对应的目的主机进行MAC地址反馈。Step S106, sending a request message (for example, an ARP request message or a ping message, or other message that may cause the host to which the destination IP belongs to respond) to the host to which the destination IP belongs; wherein the request message is used to request the foregoing The corresponding destination host in the unicast packet performs MAC address feedback.
通过本实施例,有效解决了相关技术中单播包泛洪对网络的不良影响的问题,从而有效消除网路中各交换机对该目的MAC的单播包泛洪。With the embodiment, the problem that the unicast packet flooding adversely affects the network in the related art is effectively solved, thereby effectively eliminating the unicast packet flooding of the destination MAC by each switch in the network.
在具体实施过程中,为了便于记录目的MAC,本实施例提供了一种优选实施方式,即监测网卡是否收到不属于自己的单播数据包之前,上述方法还包括:建立待清理单播泛洪数据集;其中,该待清理单播泛洪数据集中记录上述目的MAC。In a specific implementation process, in order to facilitate the recording of the destination MAC, the embodiment provides a preferred implementation manner, that is, before monitoring whether the network card receives a unicast data packet that does not belong to itself, the method further includes: establishing a unicast pan to be cleaned up. a flood data set; wherein the unicast flood data to be cleaned records the destination MAC.
对于上述待清理单播泛洪数据集,可以有多种体现形式,例如可以以待清理单播泛洪链表的形式体现,也可以是数组、栈、集合、hash表等。For the above-mentioned unicast flooding data set to be cleaned, there may be various forms, for example, it may be embodied in the form of a unicast flooding linked list to be cleaned, or may be an array, a stack, a collection, a hash table, or the like.
可选地,向目的IP所属主机发送请求报文包括以下优选实施方式:Optionally, sending the request message to the host to which the destination IP belongs includes the following preferred implementation manners:
向目的IP所属主机首次发送请求报文之后,实时监测是否满足第一条件:当前时间-请求报文发送时间≥第一预设时间;其中,上述请求报文发送时间为前一次向该主机发送请求报文的时间;如果是,则向该主机重发上述请求报文;如果否,则继续实时监测是否满足上述第一条件。After the first time the request packet is sent to the host to which the destination IP belongs, the first condition is met: the current time-request packet sending time ≥ the first preset time; wherein the request packet sending time is sent to the host the previous time. The time when the message is requested; if yes, the request message is resent to the host; if not, the real-time monitoring continues to monitor whether the first condition is met.
其中,在实时监测是否满足上述第一条件之前,上述方法还包括:确定上述待清理单播泛洪数据集中,记录有上述主机的目的MAC。Before the real-time monitoring whether the first condition is met, the method further includes: determining the unicast flood data set to be cleaned, and recording the destination MAC of the host.
可选地,向向目的IP所属主机发送请求报文还包括以下优选实施方式:Optionally, sending the request message to the host to which the destination IP belongs further includes the following preferred implementation manners:
实时监测是否满足第二条件:当前时间-单播数据包接收时间≥第二预设时间;其中,上述单播数据包接收时间为上述网卡前一次接收到上述单播数据包的时间;如果是,则将上述单播数据包对应的目的MAC,从上述待清理单播泛洪数据集中清除;如果否,则继续实时监测是否满足上述第二条件。The real-time monitoring whether the second condition is met: the current time-unicast data packet receiving time ≥ the second preset time; wherein the unicast data packet receiving time is the time when the network card receives the unicast data packet the previous time; And clearing the destination MAC corresponding to the unicast data packet from the unicast flood data set to be cleaned; if not, continuing to monitor whether the second condition is met in real time.
在具体实施过程中,第一预设时间和第二预设时间可根据实际情况进行设定。In a specific implementation process, the first preset time and the second preset time may be set according to actual conditions.
下面本发明实施例分别以发送arp报文为例、发送ping报文为例,对本发明实施例的技术方案分别说明。The following describes the technical solutions of the embodiments of the present invention by using an arp packet as an example and a ping packet as an example.
实施例一:通过发送ARP请求报文方式消除对应单播泛洪 Embodiment 1: Eliminate the corresponding unicast flood by sending an ARP request packet
本实施例提供一种通过IP终端消除局域网内单播泛洪的方法:在IP终端检测网卡收到不属于自己的单播数据包之后,解析出该单播数据包的目的IP,向该目的IP所属主机发送ARP请求报文。这样,该目的IP所属主机在收到该ARP请求报文后,会答复该ARP请求,从而使这些交换机学习到该IP所属主机的MAC,并将该MAC加入交换机的MAC转发表,从而消除网路中各交换机对该目的MAC的单播包泛洪。The embodiment provides a method for eliminating unicast flooding in a local area network by using an IP terminal: after the IP terminal detects that the NIC receives a unicast data packet that does not belong to itself, parses the destination IP address of the unicast data packet, and the purpose is The host to which the IP belongs sends an ARP Request packet. In this way, after receiving the ARP request packet, the host to which the destination IP belongs will reply to the ARP request, so that the switches learn the MAC of the host to which the IP belongs, and add the MAC to the MAC forwarding table of the switch, thereby eliminating the network. Each switch in the road floods the unicast packet of the destination MAC.
在该实施例中,会维护一个“待清理单播泛洪链表”,将检测到的非本机的每个泛洪单播包信息组织为一个表项保存到链表中(以目的MAC为表项唯一标记,表项信息包括目的MAC、目的IP、最后收到此目的MAC的单播数据包的时间、ARP请求报文发送时间)。通过重发ARP时间间隔T1控制每个表项的ARP请求报文发送间隔,通过表项老化时间T2对已完成单播泛洪的表项进行老化,删除该表项。In this embodiment, a “unicast flooding linked list to be cleaned up” is maintained, and each detected non-native flooding unicast packet information is organized into an entry and saved in a linked list (using the destination MAC as a table). The item is uniquely marked. The entry information includes the destination MAC address, the destination IP address, the last unicast data packet received by the destination MAC address, and the ARP request packet transmission time. The re-sending ARP interval T1 is used to control the interval for sending ARP request packets of each entry. The aging time of the unicast flooding entry is aging and the entry is deleted.
图2是根据本发明实施例一的技术方案流程图,如图2所示,该流程包括:2 is a flowchart of a technical solution according to Embodiment 1 of the present invention. As shown in FIG. 2, the process includes:
步骤201:创建并初始化“待清理单播泛洪链表”。Step 201: Create and initialize a "unicast flooding linked list to be cleaned up".
步骤202:启动“待清理单播泛洪链表”子线程。该子线程用于“待清理单播泛洪链表”表项的ARP请求报文重发管理、表项老化删除。该子线程在后续叙述。Step 202: Start a sub-thread of "to-be-cleaned unicast flooding list". The sub-thread is used to re-send the ARP request packet of the unicast flooding list to be cleared and delete the aging of the entry. This sub-thread is described later.
步骤203:实时动态监测网卡是否收到非本网卡的单播数据包。如果收到,进入步骤204;如果未收到,继续本步骤203。Step 203: Dynamically monitor whether the network card receives the unicast data packet that is not the local network card. If yes, go to step 204; if not, continue with step 203.
步骤204:解析收到的非本网卡单播数据包的目的MAC。Step 204: Parse the received destination MAC address of the non-local network card unicast data packet.
步骤205:判断“待清理单播泛洪链表”是否有该目的MAC对应的表项。如果有,进入步骤205a;如果没有,进入步骤206。Step 205: Determine whether the unicast flooding list to be cleaned has an entry corresponding to the destination MAC. If yes, go to step 205a; if not, go to step 206.
步骤205a:更新该目的MAC对应表项的“最后一次接收到此目的MAC单播数据包的接收时间”为当前时间,然后进入步骤203继续检测新情况。Step 205a: Update the "reception time of the last received MAC unicast data packet" of the destination MAC corresponding entry to the current time, and then proceed to step 203 to continue detecting the new situation.
步骤206:将该目的MAC表项记录到“待清理单播泛洪链表”。Step 206: Record the destination MAC entry to the "unicast flooding linked list to be cleaned up".
步骤207:解析收到的该非本网卡单播数据包的目的IP,更新对应表项的目的IP信息。Step 207: Parse the received destination IP address of the non-local network card unicast data packet, and update the destination IP address of the corresponding entry.
步骤208:向该目的IP所属主机发送ARP请求报文。Step 208: Send an ARP request packet to the host to which the destination IP belongs.
步骤209:更新该目的MAC对应表项的ARP请求发送时间为当前时间。然后进入步骤203继续检测新情况。 Step 209: Update the ARP request sending time of the destination MAC corresponding entry to the current time. Then proceed to step 203 to continue detecting the new situation.
其中,在本实施例中,上述步骤202启动的“待清理单播泛洪链表”子线程步骤如下:In this embodiment, the steps of the sub-thread of the "unicast flooding linked list to be cleaned up" initiated by the above step 202 are as follows:
步骤2101:初始化重发ARP时间间隔T1,初始化表项老化时间T2,一般T2>2T1。Step 2101: Initialize the retransmission ARP interval T1, and initialize the entry aging time T2, generally T2>2T1.
步骤2102:“待清理单播泛洪链表”表项是否空。如果为空,继续进入步骤2102;如果非空,进入步骤2103。Step 2102: Whether the unicast flooding linked list to be cleaned item is empty. If it is empty, proceed to step 2102; if not, go to step 2103.
步骤2103:检测各表项是否需要重发ARP请求数据包:如果“当前时间”减去该表项“APR请求发送时间”大于或等于T1,则重发该表项的ARP请求报文,并更新该表项的“APR请求发送时间”为当前时间。Step 2103: Detect whether each entry needs to resend the ARP request packet: if the "current time" minus the entry "APR request sending time" is greater than or equal to T1, resend the ARP request packet of the entry, and Update the APR Request Send Time of this entry to the current time.
步骤2104:检测各表项老化时间是否已到,如果已到,则清除对应表项。即如果“当前时间”减去该表项“最后一次接收到此目的MAC单播数据包的接收时间”大于或等于T2,则清除该表项。然后继续进入步骤2102。Step 2104: Check whether the aging time of each entry has arrived. If it has arrived, clear the corresponding entry. That is, if the "current time" minus the entry "the last time the receiving time of the MAC unicast packet received this destination" is greater than or equal to T2, the entry is cleared. Then proceed to step 2102.
实施例二:通过发送ping请求报文方式消除对应单播泛洪Embodiment 2: Eliminating the corresponding unicast flooding by sending a ping request packet
本实施例提供一种通过IP终端消除局域网内单播泛洪的方法:在IP终端检测网卡收到不属于自己的单播数据包之后,解析出该单播数据包的目的IP,向该目的IP所属主机发送ping请求报文。这样,该目的IP所属主机在收到该ping请求报文后,会答复该ping请求,从而使这些交换机学习到该IP所属主机的MAC,并将该MAC加入交换机的MAC转发表,从而消除网路中各交换机对该目的MAC的单播包泛洪。The embodiment provides a method for eliminating unicast flooding in a local area network by using an IP terminal: after the IP terminal detects that the NIC receives a unicast data packet that does not belong to itself, parses the destination IP address of the unicast data packet, and the purpose is The host to which the IP belongs sends a ping request packet. In this way, after receiving the ping request packet, the host to which the destination IP belongs will reply to the ping request, so that the switches learn the MAC of the host to which the IP belongs, and add the MAC to the MAC forwarding table of the switch, thereby eliminating the network. Each switch in the road floods the unicast packet of the destination MAC.
在该实施例中,会维护一个“待清理单播泛洪链表”,将检测到的非本机的每个泛洪单播包信息组织为一个表项保存到链表中(以目的MAC为表项唯一标记,表项信息包括目的MAC、目的IP、最后收到此目的MAC的单播数据包的时间、ping请求报文发送时间)。通过重发ping时间间隔T1控制每个表项的ping请求报文发送间隔,通过表项老化时间T2对已完成单播泛洪的表项进行老化,删除该表项。In this embodiment, a “unicast flooding linked list to be cleaned up” is maintained, and each detected non-native flooding unicast packet information is organized into an entry and saved in a linked list (using the destination MAC as a table). The item is uniquely marked. The entry information includes the destination MAC address, the destination IP address, the last unicast data packet received by the destination MAC address, and the ping request packet transmission time. The ping request interval is set to aging the ping request packet of each entry. The aging time of the unicast flooding entry is aging and the entry is deleted.
图3是根据本发明实施例二的技术方案流程图,如图3所示,该流程包括:FIG. 3 is a flowchart of a technical solution according to Embodiment 2 of the present invention. As shown in FIG. 3, the process includes:
步骤301:创建并初始化“待清理单播泛洪链表”。Step 301: Create and initialize a "unicast flooding linked list to be cleaned up".
步骤302:启动“待清理单播泛洪链表”子线程。该子线程用于“待清理单播泛洪链表”表项的ping请求报文重发管理、表项老化删除。该子线程在后续叙述。Step 302: Start the "unilateral flooding linked list to be cleaned up" sub-thread. The sub-thread is used to re-send the ping request packet and delete the aging of the unicast flooding list. This sub-thread is described later.
步骤303:实时动态监测网卡是否收到非本网卡的单播数据包。如果收到,进入步骤304;如果未收到,继续本步骤303。 Step 303: Dynamically monitor whether the network card receives the unicast data packet that is not the local network card. If yes, go to step 304; if not, continue with step 303.
步骤304:解析收到的非本网卡单播数据包的目的MAC。Step 304: Parse the received destination MAC address of the non-local network card unicast data packet.
步骤305:判断“待清理单播泛洪链表”是否有该目的MAC对应的表项。如果有,进入步骤305a;如果没有,进入步骤306。Step 305: Determine whether the unicast flooding list to be cleaned has an entry corresponding to the destination MAC. If yes, go to step 305a; if not, go to step 306.
步骤305a:更新该目的MAC对应表项的“最后一次接收到此目的MAC单播数据包的接收时间”为当前时间,然后进入步骤303继续检测新情况。Step 305a: Update the "reception time of the last received MAC unicast data packet" of the destination MAC corresponding entry to the current time, and then proceed to step 303 to continue detecting the new situation.
步骤306:将该目的MAC表项记录到“待清理单播泛洪链表”。Step 306: Record the destination MAC entry to the "unicast flooding linked list to be cleaned up".
步骤307:解析收到的该非本网卡单播数据包的目的IP,更新对应表项的目的IP信息。Step 307: Parse the received destination IP address of the non-local network card unicast data packet, and update the destination IP address of the corresponding entry.
步骤308:向该目的IP所属主机发送ping请求报文。Step 308: Send a ping request packet to the host to which the destination IP belongs.
步骤309:更新该目的MAC对应表项的ping请求发送时间为当前时间。然后进入步骤203继续检测新情况。Step 309: Update the ping request sending time of the destination MAC corresponding entry to the current time. Then proceed to step 203 to continue detecting the new situation.
其中,在本实施例中,上述步骤302启动的“待清理单播泛洪链表”子线程步骤如下:In this embodiment, the steps of the sub-thread of the "unicast flooding linked list to be cleaned up" initiated by the above step 302 are as follows:
步骤3101:初始化重发ARP时间间隔T1,初始化表项老化时间T2,一般T2>2T1。Step 3101: Initialize the retransmission ARP interval T1, and initialize the entry aging time T2, generally T2>2T1.
步骤3102:“待清理单播泛洪链表”表项是否空。如果为空,继续进入步骤3102;如果非空,进入步骤3103。Step 3102: Whether the item of the unicast flooding linked list to be cleaned is empty. If it is empty, proceed to step 3102; if not, go to step 3103.
步骤3103:检测各表项是否需要重发ping请求数据包:如果“当前时间”减去该表项“ping请求发送时间”大于或等于T1,则重发该表项的ping请求报文,并更新该表项的“ping请求发送时间”为当前时间。Step 3103: Detect whether each entry needs to resend the ping request packet: if the current time minus the ping request sending time is greater than or equal to T1, the ping request packet of the entry is resent, and Update the "ping request send time" of this entry to the current time.
步骤3104:检测各表项老化时间是否已到,如果已到,则清除对应表项。即如果“当前时间”减去该表项“最后一次接收到此目的MAC单播数据包的接收时间”大于或等于T2,则清除该表项。然后继续进入步骤3102。Step 3104: Detect whether the aging time of each entry has arrived. If yes, clear the corresponding entry. That is, if the "current time" minus the entry "the last time the receiving time of the MAC unicast packet received this destination" is greater than or equal to T2, the entry is cleared. Then proceed to step 3102.
以上所述仅为本发明的优选实施例而已,通过不同的方法检测非本机是否收到非本机的单播数据包,通过向“收到非本机的单播数据包目的IP所属主机”发送除ARP请求报文、ping报文之外的其他可引起“收到非本机的单播数据包目的IP所属主机”回复响应的其他报文,或间接导致向“收到非本机的单播数据包目的IP所属主机”发送ARP请求报文、ping报文的方法,均可实现本发明的技术方案。 The above description is only a preferred embodiment of the present invention. It is detected by different methods whether a non-native unicast data packet is received by the local device, and the host belongs to the host that receives the non-native unicast data packet destination. Sending other messages except the ARP request message and the ping message that may cause the "received host of the non-native unicast data packet destination host" to respond, or indirectly causing the "received non-native device" The unicast data packet destination IP belongs to the host, and the method for sending the ARP request packet and the ping packet can implement the technical solution of the present invention.
对应于上述实施例介绍的单播数据包的处理方法,本实施例提供了一种单播数据包的处理装置,该装置可以设置在终端侧,用以实现上述实施例。图4是根据本发明实施例的单播数据包的处理装置的结构框图,如图4所示,该装置包括:数据包监测模块10、IP解析模块20和报文发送模块30。下面对该结构进行详细介绍。Corresponding to the processing method of the unicast data packet introduced in the foregoing embodiment, the embodiment provides a processing device for the unicast data packet, and the device may be disposed on the terminal side to implement the foregoing embodiment. FIG. 4 is a structural block diagram of a processing apparatus for a unicast data packet according to an embodiment of the present invention. As shown in FIG. 4, the apparatus includes: a data packet monitoring module 10, an IP parsing module 20, and a message sending module 30. The structure is described in detail below.
数据包监测模块10,设置为监测网卡是否收到不属于自己的单播数据包;The data packet monitoring module 10 is configured to monitor whether the network card receives a unicast data packet that does not belong to itself;
IP解析模块20,设置为在监测收到所述单播数据包后,解析出所述单播数据包的目的IP;The IP parsing module 20 is configured to parse the destination IP of the unicast data packet after monitoring the receiving the unicast data packet;
报文发送模块30,设置为向目的IP所属主机发送请求报文;其中,所述请求报文用于要求对所述单播数据包中对应的目的主机进行MAC地址反馈。The message sending module 30 is configured to send a request message to the host to which the destination IP belongs. The request message is used to request MAC address feedback for the corresponding destination host in the unicast data packet.
在具体实施过程中,为了便于记录目的MAC,本实施例提供了一种优选实施方式,即所述装置还包括:数据集建立模块,设置为在监测网卡是否收到不属于自己的单播数据包之前,建立待清理单播泛洪数据集;其中,所述待清理单播泛洪数据集中记录所述目的MAC。In a specific implementation process, in order to facilitate the recording of the destination MAC, the embodiment provides a preferred implementation manner, that is, the apparatus further includes: a data set establishing module, configured to monitor whether the network card receives unicast data that is not its own. Before the packet, the unicast flood data set to be cleaned is set up; wherein the destination unicast flood data is to be recorded in the centralized MAC address.
可选地,所述报文发送模块30包括:第一条件判断单元,设置为向目的IP所属主机首次发送请求报文之后,实时监测是否满足第一条件:当前时间-请求报文发送时间≥第一预设时间;其中,所述请求报文发送时间为前一次向该主机发送请求报文的时间;第一处理单元,设置为在判断结果为是的情况下,向该主机重发所述请求报文;在判断结果为否的情况下,继续实时监测是否满足所述第一条件。Optionally, the message sending module 30 includes: a first condition determining unit, configured to monitor whether the first condition is met after the first time the request packet is sent to the host to which the destination IP belongs: the current time-request message sending time ≥ a first preset time; wherein the request message sending time is a time when the request message is sent to the host for the previous time; the first processing unit is configured to resend the host to the host if the judgment result is yes The request message is sent; if the judgment result is no, the real-time monitoring continues to monitor whether the first condition is satisfied.
所述报文发送模块30还包括:记录确定单元,设置为在所述第一条件判断单元实时监测是否满足所述第一条件之前,确定所述待清理单播泛洪数据集中,记录有所述主机的目的MAC。The message sending module 30 further includes: a record determining unit, configured to determine, in the real-time monitoring, whether the first condition determining unit meets the first condition, determining the unicast flooding data set to be cleaned, and recording The destination MAC of the host.
所述报文发送模块30还包括:第二条件判断单元,设置为实时监测是否满足第二条件:当前时间-单播数据包接收时间≥第二预设时间;其中,所述单播数据包接收时间为所述网卡前一次接收到所述单播数据包的时间;第二处理单元,设置为在判断结果为是的情况下,将所述单播数据包对应的目的MAC,从所述待清理单播泛洪数据集中清除;在判断结果为否的情况下,继续实时监测是否满足所述第二条件。The message sending module 30 further includes: a second condition determining unit configured to monitor whether the second condition is met in real time: the current time-unicast data packet receiving time ≥ the second preset time; wherein the unicast data packet The receiving time is the time when the NIC received the unicast data packet the previous time; the second processing unit is configured to: if the determination result is yes, the destination MAC corresponding to the unicast data packet, from the The unicast flood data to be cleaned is cleared; if the judgment result is no, the real-time monitoring continues to monitor whether the second condition is satisfied.
本发明实施例通过自动检测网卡是否收到目的MAC为非本网卡MAC的单播数据包,如果收到,则解析出该单播数据包的目的IP,然后向该目的IP所属主机发送arp请求报文、或ping报文等。这样,该目的IP所属主机就会回复arp请求报文或回复 ping报文,这些回复报文就会通过网络中的交换机,使这些交换机学习到该IP所属主机的MAC,并将该MAC加入交换机的MAC转发表,从而消除网路中各交换机对该目的MAC的单播包泛洪。The embodiment of the present invention automatically detects whether the network card receives the unicast data packet whose destination MAC address is not the MAC address of the local network card, and if received, parses the destination IP address of the unicast data packet, and then sends an arp request to the host to which the destination IP belongs. Packet, or ping message, etc. In this way, the host to which the destination IP belongs will reply to the arp request message or reply. Ping packets, these replies will pass through the switches in the network, so that the switches learn the MAC of the host to which the IP belongs, and add the MAC to the MAC forwarding table of the switch, thereby eliminating the MACs of the switches in the network. The unicast package is flooded.
尽管为示例目的,已经公开了本发明的优选实施例,本领域的技术人员将意识到各种改进、增加和取代也是可能的,因此,本发明的范围应当不限于上述实施例。While the preferred embodiments of the present invention have been disclosed for purposes of illustration, those skilled in the art will recognize that various modifications, additions and substitutions are possible, and the scope of the invention should not be limited to the embodiments described above.
工业实用性Industrial applicability
如上所述,通过上述实施例及优选实施方式,目的IP所属主机就会回复arp请求报文或回复ping报文,这些回复报文就会通过网络中的交换机,使这些交换机学习到该IP所属主机的MAC,并将该MAC加入交换机的MAC转发表,从而消除网路中各交换机对该目的MAC的单播包泛洪。 As described above, in the foregoing embodiment and the preferred embodiment, the host to which the destination IP belongs will reply to the arp request packet or the reply ping packet, and the reply packets will pass through the switch in the network, so that the switches learn the IP address. The MAC address of the host is added to the MAC forwarding table of the switch, thereby eliminating the flooding of the unicast packets of the destination MAC by each switch in the network.

Claims (10)

  1. 一种单播数据包的处理方法,所述方法包括:A method for processing a unicast data packet, the method comprising:
    监测网卡是否收到不属于自己的单播数据包;Monitor whether the NIC receives a unicast packet that does not belong to itself;
    在监测收到所述单播数据包后,解析出所述单播数据包的目的网络互联协议IP;After monitoring the received unicast data packet, parsing the destination network interconnection protocol IP of the unicast data packet;
    向目的IP所属主机发送请求报文;其中,所述请求报文用于要求对所述单播数据包中对应的目的主机进行MAC地址反馈。The request message is sent to the host to which the destination IP belongs, and the request message is used to request MAC address feedback for the corresponding destination host in the unicast data packet.
  2. 如权利要求1所述的方法,其中,监测网卡是否收到不属于自己的单播数据包之前,所述方法还包括:The method of claim 1, wherein the method further comprises: before monitoring whether the network card receives a unicast data packet that does not belong to itself, the method further comprising:
    建立待清理单播泛洪数据集;其中,所述待清理单播泛洪数据集中记录所述目的MAC。Establishing a unicast flood data set to be cleaned; wherein the unicast flood data to be cleaned records the destination MAC.
  3. 如权利要求2所述的方法,其中,向目的IP所属主机发送请求报文包括:The method of claim 2, wherein the sending the request message to the host to which the destination IP belongs includes:
    向目的IP所属主机首次发送请求报文之后,实时监测是否满足第一条件:当前时间-请求报文发送时间≥第一预设时间;其中,所述请求报文发送时间为前一次向该主机发送请求报文的时间;After the first time the request packet is sent to the host to which the destination IP belongs, the first condition is met: the current time-request packet sending time ≥ the first preset time; wherein the request packet sending time is the previous time to the host The time when the request message was sent;
    如果是,则向该主机重发所述请求报文;如果否,则继续实时监测是否满足所述第一条件。If yes, the request message is resent to the host; if not, the real-time monitoring continues to monitor whether the first condition is met.
  4. 如权利要求3所述的方法,其中,实时监测是否满足所述第一条件之前,所述方法还包括:The method of claim 3, wherein the method further comprises: before real time monitoring whether the first condition is met, the method further comprising:
    确定所述待清理单播泛洪数据集中,记录有所述主机的目的MAC。Determining the unicast flood data set to be cleaned, and recording the destination MAC of the host.
  5. 如权利要求2所述的方法,其中,向目的IP所属主机发送请求报文还包括:The method of claim 2, wherein the sending the request message to the host to which the destination IP belongs further includes:
    实时监测是否满足第二条件:当前时间-单播数据包接收时间≥第二预设时间;其中,所述单播数据包接收时间为所述网卡前一次接收到所述单播数据包的时间;Real time monitoring whether the second condition is met: the current time - the unicast data packet receiving time ≥ the second preset time; wherein the unicast data packet receiving time is the time when the network card receives the unicast data packet ;
    如果是,则将所述单播数据包对应的目的MAC,从所述待清理单播泛洪数据集中清除;如果否,则继续实时监测是否满足所述第二条件。If yes, the destination MAC corresponding to the unicast data packet is cleared from the unicast flooding data set to be cleaned; if not, the real-time monitoring continues to monitor whether the second condition is met.
  6. 一种单播数据包的处理装置,所述装置包括: A processing device for a unicast data packet, the device comprising:
    数据包监测模块,设置为监测网卡是否收到不属于自己的单播数据包;a packet monitoring module configured to monitor whether the network card receives a unicast data packet that is not its own;
    IP解析模块,设置为在监测收到所述单播数据包后,解析出所述单播数据包的目的网络互联协议IP;The IP parsing module is configured to parse the destination network interconnection protocol IP of the unicast data packet after monitoring the receiving the unicast data packet;
    报文发送模块,设置为向目的IP所属主机发送请求报文;其中,所述请求报文用于要求对所述单播数据包中对应的目的主机进行MAC地址反馈。The message sending module is configured to send a request message to the host to which the destination IP belongs, where the request message is used to request MAC address feedback for the corresponding destination host in the unicast data packet.
  7. 如权利要求6所述的装置,其中,所述装置还包括:The device of claim 6 wherein said device further comprises:
    数据集建立模块,设置为在监测网卡是否收到不属于自己的单播数据包之前,建立待清理单播泛洪数据集;其中,所述待清理单播泛洪数据集中记录所述目的MAC。a data set establishing module, configured to: before the monitoring network card receives the unicast data packet that is not its own, establish a unicast flooding data set to be cleaned; wherein the unicast flooding data to be cleaned records the destination MAC address .
  8. 如权利要求7所述的装置,其中,所述报文发送模块包括:The apparatus of claim 7, wherein the message sending module comprises:
    第一条件判断单元,设置为向目的IP所属主机首次发送请求报文之后,实时监测是否满足第一条件:当前时间-请求报文发送时间≥第一预设时间;其中,所述请求报文发送时间为前一次向该主机发送请求报文的时间;The first condition judging unit is configured to monitor whether the first condition is met after the request packet is sent to the host to which the destination IP belongs for the first time: the current time-request packet sending time ≥ the first preset time; wherein the request message The sending time is the time when the request message was sent to the host the previous time;
    第一处理单元,设置为在判断结果为是的情况下,向该主机重发所述请求报文;在判断结果为否的情况下,继续实时监测是否满足所述第一条件。The first processing unit is configured to: when the determination result is yes, resend the request message to the host; if the determination result is no, continue to monitor whether the first condition is met in real time.
  9. 如权利要求8所述的装置,其中,所述报文发送模块还包括:The device of claim 8, wherein the message sending module further comprises:
    记录确定单元,设置为在所述第一条件判断单元实时监测是否满足所述第一条件之前,确定所述待清理单播泛洪数据集中,记录有所述主机的目的MAC。The record determining unit is configured to determine, in the real-time monitoring, whether the first condition is that the first condition determining unit meets the first condition, the unicast flooding data set to be cleaned, and record the destination MAC of the host.
  10. 如权利要求7所述的装置,其中,所述报文发送模块还包括:The device of claim 7, wherein the message sending module further comprises:
    第二条件判断单元,设置为实时监测是否满足第二条件:当前时间-单播数据包接收时间≥第二预设时间;其中,所述单播数据包接收时间为所述网卡前一次接收到所述单播数据包的时间;The second condition determining unit is configured to monitor whether the second condition is met in real time: the current time-unicast data packet receiving time ≥ the second preset time; wherein the unicast data packet receiving time is that the network card received the previous time The time of the unicast data packet;
    第二处理单元,设置为在判断结果为是的情况下,将所述单播数据包对应的目的MAC,从所述待清理单播泛洪数据集中清除;在判断结果为否的情况下,继续实时监测是否满足所述第二条件。 The second processing unit is configured to: if the determination result is yes, clear the destination MAC corresponding to the unicast data packet from the unicast flooding data set to be cleaned; if the determination result is no, Continue to monitor in real time whether the second condition is met.
PCT/CN2015/084951 2014-10-15 2015-07-23 Processing method and device for unicast data package WO2016058429A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410542976.1 2014-10-15
CN201410542976.1A CN105577550A (en) 2014-10-15 2014-10-15 Processing method and apparatus for unicast data packet

Publications (1)

Publication Number Publication Date
WO2016058429A1 true WO2016058429A1 (en) 2016-04-21

Family

ID=55746099

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/084951 WO2016058429A1 (en) 2014-10-15 2015-07-23 Processing method and device for unicast data package

Country Status (2)

Country Link
CN (1) CN105577550A (en)
WO (1) WO2016058429A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113726632A (en) * 2021-07-31 2021-11-30 新华三信息安全技术有限公司 Message forwarding method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6456597B1 (en) * 1998-05-04 2002-09-24 Hewlett Packard Co. Discovery of unknown MAC addresses using load balancing switch protocols
CN101616082A (en) * 2009-07-29 2009-12-30 杭州华三通信技术有限公司 The method and apparatus that message is handled in a kind of virtual private LAN service network
CN103581062A (en) * 2012-08-09 2014-02-12 国际商业机器公司 Method and system for handling unknown unicast data packets

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6456597B1 (en) * 1998-05-04 2002-09-24 Hewlett Packard Co. Discovery of unknown MAC addresses using load balancing switch protocols
CN101616082A (en) * 2009-07-29 2009-12-30 杭州华三通信技术有限公司 The method and apparatus that message is handled in a kind of virtual private LAN service network
CN103581062A (en) * 2012-08-09 2014-02-12 国际商业机器公司 Method and system for handling unknown unicast data packets

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113726632A (en) * 2021-07-31 2021-11-30 新华三信息安全技术有限公司 Message forwarding method and device

Also Published As

Publication number Publication date
CN105577550A (en) 2016-05-11

Similar Documents

Publication Publication Date Title
EP3007494B1 (en) Data processing method and device
WO2016165463A1 (en) Software defined network-based link failure reporting method and forwarding device
JP2018500836A5 (en)
WO2015180292A1 (en) Method and apparatus for detecting user network interface connectivity of virtual private network
WO2017035763A1 (en) Data packet transmission method utilized in ipv6 network and device utilizing same
WO2017190467A1 (en) Adjustment method and apparatus for maximum transmission unit of terminal, and terminal device
CN103227777B (en) A kind of dpd of preventing detects the method unsuccessfully causing ipsec tunnel to shake
WO2016090978A1 (en) Traffic switching method and device
CN102769520B (en) Wireless network congestion control method based on stream control transmission protocol (SCTP)
WO2016026299A1 (en) Method and device for retransmitting lost packet
WO2018010616A1 (en) Link layer based network management
WO2015070614A1 (en) Method and device for detecting connectivity of user side interfaces of l2vpn
TWI580226B (en) Method for determining maximum segment size
CN105812318A (en) Method, controller and system for preventing attack in network
WO2015123853A1 (en) Data flow processing method and apparatus
WO2014127517A1 (en) Packet processing method, forwarder, packet processing device and packet processing system
WO2011012004A1 (en) Method and system for realizing network flow cleaning
WO2016058429A1 (en) Processing method and device for unicast data package
WO2017219868A1 (en) Arp entry processing method and apparatus
CN106850281B (en) Network equipment management method
CN112887312B (en) Slow protocol message processing method and related device
CN109600277B (en) IPSec tunnel keep-alive method and device based on NAT equipment
CN106230658A (en) A kind of method and apparatus monitoring the network equipment
WO2015027523A1 (en) Method and device for determining tcp port scanning
CN103401780A (en) Method and equipment for building routing by linking RIP (routing information protocol) with BFD (bidirectional forwarding detection)

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15849946

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15849946

Country of ref document: EP

Kind code of ref document: A1