WO2016183732A1 - 一种数据包转发方法和网络设备 - Google Patents

一种数据包转发方法和网络设备 Download PDF

Info

Publication number
WO2016183732A1
WO2016183732A1 PCT/CN2015/079071 CN2015079071W WO2016183732A1 WO 2016183732 A1 WO2016183732 A1 WO 2016183732A1 CN 2015079071 W CN2015079071 W CN 2015079071W WO 2016183732 A1 WO2016183732 A1 WO 2016183732A1
Authority
WO
WIPO (PCT)
Prior art keywords
forwarding entry
entry
layer
data packet
physical address
Prior art date
Application number
PCT/CN2015/079071
Other languages
English (en)
French (fr)
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 华为技术有限公司
Priority to EP15892113.0A priority Critical patent/EP3288224B1/en
Priority to PCT/CN2015/079071 priority patent/WO2016183732A1/zh
Priority to CN201580001163.4A priority patent/CN107409088B/zh
Publication of WO2016183732A1 publication Critical patent/WO2016183732A1/zh
Priority to US15/812,642 priority patent/US10541914B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/66Layer 2 routing, e.g. in Ethernet based MAN's
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/22Alternate routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/50Routing or path finding of packets in data switching networks using label swapping, e.g. multi-protocol label switch [MPLS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/10Mapping addresses of different types
    • H04L61/103Mapping addresses of different types across network layers, e.g. resolution of network layer into physical layer addresses or address resolution protocol [ARP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • H04L12/4641Virtual LANs, VLANs, e.g. virtual private networks [VPN]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/20Hop count for routing purposes, e.g. TTL
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/42Centralised routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/54Organization of routing tables
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/2514Translation of Internet protocol [IP] addresses between local and global IP addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/58Caching of addresses or names

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a data packet forwarding method and a network device.
  • OpenFlow is to convert the packet forwarding process originally controlled by the switch/router into OpenFlow switch (full name: OpenFlow Switch, referred to as: OFS) and OpenFlow control server (full name: OpenFlow Controller, referred to as: OFC). Work together to achieve separation of data forwarding and routing control;
  • the OFS maintains the flow table (FlowTable) and forwards it only according to the FlowTable.
  • the generation, maintenance, and delivery of the FlowTable are completely implemented by the OFC.
  • the OFS can receive the flow rules sent by the OFC and store it in the FlowTable.
  • the flow table may be a plurality of flow tables, and each flow table includes multiple entries, and each entry is a flow rule, and the entry may include a Match Field and a counter as shown in FIG. 1 . Counters) and instructions, where the matching field is used to match the received packet, the counter records the statistics of the entry and the packet, and the instruction set determines how to forward the packet.
  • the hardware learning and flow table management functions of the OFS are closed, and the OFS cannot find the corresponding data packet for the received data.
  • the data packet is forwarded to the OFC, and the OFC determines the forwarding action of the packet, and sends a new forwarding rule to the OFS, and the OFS forwards the data packet according to the forwarding rule;
  • the decision is made by the OFC, which reduces the processing efficiency of the new data packet; and if the OFS and the OFS The OFC link is broken, and OFS is unable to process the received new data packet, which reduces network performance.
  • the invention provides a data packet forwarding method and a network device, which can be learned through a software layer.
  • the forwarding rule matches the new data packet, improves the processing efficiency of the new data packet, and further improves the network performance.
  • a first aspect of the present invention provides a data packet forwarding method, where the data packet forwarding method is applied to a network device, and a self-learning function of the hardware layer of the network device is closed and used to maintain a first matching table, where the network device is The self-learning function of the software layer is turned on and used to maintain the second matching table, the method comprising:
  • the entry matching the data packet does not exist in the first matching table, acquiring a local physical address and a destination physical address of the data packet, and determining the local physical address and a destination physics of the data packet Whether the addresses are the same;
  • the method further includes:
  • the matching domain of the Layer 2 forwarding entry includes a destination physical address of the data packet and a virtual local area network (VLAN) VLAN identifier, and the instruction set of the Layer 2 forwarding entry includes an output port number.
  • VLAN virtual local area network
  • the matching field of the Layer 3 forwarding entry includes at least one of the following: an input port number, a destination physical address, a destination IP address, and a source IP address of the data packet, and the instruction set of the Layer 3 forwarding entry includes an output. Port number, TTL instruction, and physical address modification instructions.
  • the method further includes:
  • the first matching table includes a physical address table, and after the generating a Layer 2 forwarding entry, the method further includes:
  • the method further include:
  • the Layer 2 forwarding entry and the forwarding entry generating instruction indicate that the generated forwarding entry is different, the Layer 2 forwarding entry is modified according to the forwarding entry generation instruction.
  • the method further include:
  • the second matching table includes a physical address table, and if the second matching table does not have an entry with the same physical address and the destination physical address, the method Also includes:
  • the first matching table includes at least one of a routing table and an address resolution protocol ARP mapping table, if the second matching table There is no entry matching the destination IP address, and the method further includes:
  • the created entry is updated according to the routing result, and the status of the created entry is marked as "learned".
  • the method includes:
  • a second aspect of the present invention provides a network device, wherein a self-learning function of a hardware layer of the network device is closed and used to maintain a first matching table, and a self-learning function of the software layer of the network device is enabled and used for maintaining The two matching tables, the network device includes:
  • a packet receiving module configured to receive a data packet, and detect whether an entry matching the data packet exists in the first matching table
  • a service judging module configured to acquire a local physical address and a destination physical address of the data packet, and determine the local physical address and the location if the entry matching the data packet does not exist in the first matching table Whether the destination physical address of the data packet is the same;
  • a layer 2 service processing module configured to: if the local physical address and the destination physical address are different And obtaining, by the second matching table, an entry whose physical address matches the destination physical address, and generating a Layer 2 forwarding entry according to the entry matched by the destination physical address;
  • a packet forwarding module configured to forward the data packet according to the layer 2 forwarding entry.
  • the network device further includes:
  • a Layer 3 service processing module configured to acquire a destination IP address of the data packet if the local physical address and the destination physical address are the same, and search for the destination IP address from the second matching table And generating a Layer 3 forwarding entry according to the entry matching the destination IP address;
  • the packet forwarding module is further configured to:
  • the matching domain of the Layer 2 forwarding entry includes a destination physical address of the data packet and a virtual local area network (VLAN) VLAN identifier, and the instruction set of the Layer 2 forwarding entry includes an output port number.
  • VLAN virtual local area network
  • the matching field of the Layer 3 forwarding entry includes at least one of the following: an input port number, a destination physical address, a destination IP address, and a source IP address of the data packet, and the instruction set of the Layer 3 forwarding entry includes an output. Port number, TTL instruction, and physical address modification instructions.
  • the packet sending module is further configured to:
  • the network device further includes:
  • the instruction receiving module is configured to receive the forwarding entry generation instruction sent by the controller, and generate a forwarding entry in the first matching table according to the forwarding entry generation instruction.
  • the first matching table includes a physical address table, where the layer 2 service processing module is further configured to:
  • the network device further includes:
  • An index number obtaining module configured to obtain an index number of the second layer forwarding entry in the first matching table
  • a report message generating module for generating a report message
  • a report sending module configured to send the report message to the controller, where the report message includes the index number and the data packet, so that the controller generates a forwarding entry generation instruction according to the data packet,
  • the forwarding entry generation instruction includes the index number
  • An instruction receiving module configured to receive the configuration information forwarding entry generation instruction sent by the controller, and search for the second from the first matching table according to the index number in the forwarding entry generation instruction Layer forwarding entry;
  • An entry determining module configured to determine whether the forwarding entry generated by the Layer 2 forwarding entry and the forwarding entry generation instruction is the same;
  • the Layer 2 service processing module is further configured to:
  • the Layer 2 forwarding entry and the forwarding entry generating instruction indicate that the generated forwarding entry is different, the Layer 2 forwarding entry is modified according to the forwarding entry generation instruction.
  • the network device further includes:
  • An index number obtaining module configured to obtain an index number of the second layer forwarding entry in the first matching table
  • a report message generating module for generating a report message
  • a report sending module configured to send the report message and the layer 2 forwarding entry to the controller, where the report message includes the index number and the data packet, so that the controller is configured according to the data
  • the packet generates a forwarding entry generation instruction
  • An instruction receiving module configured to receive the forwarding entry generation instruction sent by the controller when determining that the forwarding entry generated by the forwarding entry generation instruction is different from the Layer 2 forwarding entry, the forwarding
  • the publication item generation instruction includes the index number
  • the Layer 2 service processing module is further configured to:
  • the second matching table includes a physical address table
  • the network device further includes:
  • a software learning module configured to: if there is no physical address and the target physics in the second matching table The entry with the same address records the source physical address, the VLAN identifier, and the input port number of the data packet into the physical address table of the second matching table.
  • the first matching table includes at least one of a routing table and an address resolution protocol ARP mapping table, where the network device further includes:
  • the created entry is updated according to the routing result, and the status of the created entry is marked as "learned".
  • the network device further includes:
  • a software learning module configured to receive at least one entry that is sent by the controller, and save the at least one entry to the second matching table.
  • the third aspect of the present invention further provides a network device, the self-learning function of the hardware layer of the network device is closed and used to maintain a first matching table, and the self-learning function of the software layer of the network device is enabled and used to maintain the second a matching table,
  • the network device includes a network interface, a memory, and a processor, wherein the memory stores a set of programs, and the processor is configured to invoke a program stored in the memory, such that the network device performs the first aspect Provides some or all of the steps of a packet forwarding method.
  • a fourth aspect of the present invention also provides a computer storage medium storing a program, the program being executed for causing a computer to perform some or all of the steps of a packet forwarding method provided by the first aspect .
  • the network device when the network device detects that there is no entry matching the received data packet in the first matching table, the local physical address and the destination physical address of the data packet are obtained for service determination, if the local physical address and the If the destination physical address is different, the data packet is a Layer 2 service. Then, the second matching table is used to find the entry with the same physical address as the destination physical address, and a Layer 2 forwarding entry is generated. The data packet is forwarded according to the Layer 2 forwarding entry, and the forwarding rule learned by the software layer is matched to the new data packet, thereby improving the processing efficiency of the new data packet, and further improving the network performance.
  • Figure 1 shows a schematic structural view of an entry
  • FIG. 2 is a schematic flowchart of a data packet forwarding method according to a first embodiment of the present invention
  • FIG. 3 is a schematic flowchart of a method for processing a layer 2 service according to a second embodiment of the present invention
  • FIG. 4 is a schematic flowchart of another method for processing a Layer 2 service according to a third embodiment of the present invention.
  • FIG. 5 is a schematic flowchart of a method for processing a three-layer service according to a fourth embodiment of the present invention.
  • FIG. 6 is a schematic flowchart diagram of another method for processing a three-layer service according to a fifth embodiment of the present invention.
  • FIG. 7 is a schematic flowchart diagram of another packet forwarding method according to a sixth embodiment of the present invention.
  • FIG. 8 is a schematic flowchart of a method for updating a matching table according to a seventh embodiment of the present invention.
  • FIG. 9 is a schematic flowchart of another method for updating a matching table according to an eighth embodiment of the present invention.
  • FIG. 10 is a schematic structural diagram of a network device according to a ninth embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of another network device according to a tenth embodiment of the present invention.
  • the packet forwarding method provided by the embodiment of the present invention is applied to a network device, such as a Layer 2 switch, and three a layer switch or a router, etc., the self-learning function of the hardware layer of the network device is closed and used to maintain the first matching table, that is, the learning module of the hardware layer cannot learn the received data packet, and the first matching table thereof
  • a network device such as a Layer 2 switch, and three a layer switch or a router, etc.
  • the self-learning function of the hardware layer of the network device is closed and used to maintain the first matching table, that is, the learning module of the hardware layer cannot learn the received data packet, and the first matching table thereof
  • Each of the entries is sent by the controller;
  • the self-learning function of the software layer of the network device is enabled and used to maintain the second matching table, that is, the learning module of the software layer can learn the received data packet to update the
  • the second matching table wherein the learning module of the software layer performs self-learning, please refer to the corresponding descriptions of FIG.
  • FIG. 2 is a schematic flowchart of a data packet forwarding method according to a first embodiment of the present invention.
  • the method shown in FIG. 2 may include:
  • Step S201 receiving a data packet, and detecting whether there is an entry matching the data packet in the first matching table; if there is an entry matching the data packet in the first matching table, the process ends; otherwise, Step S202 is performed;
  • the first matching table may include at least one of a physical address table, a routing table, and an ARP (English: Address Resolution Protocol) mapping table.
  • the network device may detect The service type of the data packet, if the data packet is a Layer 2 service, obtain the destination physical address of the data packet, and check whether the physical address table has an entry matching the physical address and the destination physical address, if not, If the first matching table does not have an entry that matches the data packet, step S202 is performed; if the data packet is a three-layer service, the destination IP address of the data packet is obtained, and the destination IP address and the routing table are obtained.
  • Each of the masks is subjected to a bitwise AND operation.
  • step S202 If the result of the operation is different from the corresponding network address, or if there is an entry in the ARP mapping table with the same IP address and destination IP address, if there is no IP address and The entry with the same destination IP address indicates that the entry matching the data packet does not exist in the first matching table, and step S202 is performed.
  • Step S202 Acquire a local physical address and a destination physical address of the data packet, and determine whether the local physical address and the destination physical address of the data packet are the same; if the local physical address and the destination physical of the data packet The address is different, indicating that the data packet is a Layer 2 service, and the processing flow of the Layer 2 service is performed, that is, step S203 is performed; if the local physical address and the destination physical address of the data packet are the same, the data packet is three.
  • Layer service the processing flow of the three-layer service is executed, that is, step S205 is performed;
  • the network device when the network device detects that there is no entry matching the data packet in the first matching table, the network device further matches the data packet with the second matching table, where the second matching table may be
  • the learning module has a self-learning function, and the entries in the second matching table are more than the entries in the first matching table, and are more likely to query the entries matching the data packet;
  • the data packet is directly sent to the controller, and the forwarding rule of the data packet generated by the controller improves the processing efficiency of the new data packet.
  • Step S203 searching for an entry matching the physical address and the destination physical address from the second matching table, and generating a Layer 2 forwarding entry according to the entry matching the destination physical address;
  • the second matching table includes a physical address table.
  • the network device obtains the destination physical address of the data packet, and queries the physical address table of the second matching table whether there is an entry matching the physical address and the destination physical address. If yes, a Layer 2 forwarding entry is generated according to the entry that matches the destination physical address, where the matching domain of the Layer 2 forwarding entry includes the destination physical address of the data packet and the virtual local area network VLAN identifier, and the second layer
  • the instruction set of the forwarding entry includes an output port number, and the output port number is determined according to an output port number of the entry matched in the second matching table;
  • the network device may further record a source physical address, a VLAN identifier, and an input port number of the data packet to the second matching table.
  • the network device learns the received data packet as much as possible, so that the physical address table in the second matching table is as much as possible, which can improve the success rate of the data packet routing; if the source physical address of the data packet A is 11-22-33-44-55-66, the destination physical address is 22-22-33-44-55-77, the VLAN ID is 11, and the network device detects the second match through the port 1 of the network device.
  • the forwarding rule of the packet can be determined. Record the information of packet A, when receiving the destination physical address is 11-22-33-44-55- When the packet of 66 is used, the forwarding rule of the packet cannot be queried;
  • the network device may further detect, in the second matching table, whether an entry with a physical address matching the source physical address exists, and if not, record a source physical address, a VLAN identifier, and an input port of the data packet. The number can be saved in the physical address table of the second matching table.
  • the network device may also periodically send an update request to the controller for the second matching table to update the second matching table stored in the local device; the controller may also periodically send the second to the network device actively. Matching the table to update the second matching table stored on the local end of the network device;
  • the network device may process the method according to the prior art, such as dropping the data packet, forwarding by default output port, and the like. data pack.
  • Step S204 Forward the data packet according to the Layer 2 forwarding entry.
  • the generated Layer 2 forwarding entry is sent to the hardware, and the data packet can be forwarded according to the Layer 2 forwarding entry. It should be noted that how the network device forwards the data packet according to the Layer 2 forwarding entry is in the field. It can be understood by the skilled person that the data packet is forwarded according to the matching table in the first matching table in the prior art, and details are not described herein again.
  • Step S205 Acquire a destination IP address of the data packet, and look up an entry matching the destination IP address from the second matching table, and generate a three-layer forwarding table according to the entry matching the destination IP address. item;
  • the second matching table includes at least one of a routing table and an ARP mapping table.
  • the network device obtains a destination IP address of the data packet, and performs a bitwise manner on the destination IP address and each mask of the routing table. And the operation, if the result of the operation is the same as the corresponding network address, the three-layer forwarding entry is generated according to the entry; or the network device detects whether there is an entry with the same IP address and the destination IP address in the ARP mapping table. If yes, a Layer 3 forwarding entry is generated according to the entry matching the destination IP address.
  • the matching field of the Layer 3 forwarding entry includes at least one of the following: an input port number, a destination physical address, a destination IP address, and a source IP address of the data packet, and an instruction set of the Layer 3 forwarding entry.
  • the output port number, the TTL instruction, and the modified physical address instruction are determined, and the output port number is determined according to an output port number of a matching entry in the second matching table, where the TTL instruction is used to reduce TTL, the modified physical The address command is used to modify the source physical address and the destination physical address.
  • the Layer 3 forwarding entry may further include an Ethernet type of the data packet.
  • the network device may further create a new entry in the second matching table according to the header information of the data packet, and create The entry is marked as "learning", the received data packet is routed through a routing protocol, the created entry is updated according to the routing result, and the status of the created entry is marked as "already Learn”.
  • the network device may query its neighboring network device whether the data exists. The forwarding rule of the packet, if there is a forwarding rule of the data packet in the neighboring network device, the entry created by the neighboring network device is updated, such as according to the neighboring network device in the local network device.
  • the number of the output port is determined by the output port number, and the destination physical address is determined according to the physical address of the neighboring network device. After the created entry is updated, the entry is identified as " already learned.”
  • the learning module of the network device software layer can learn the received data packet by using the learning method of the prior art.
  • the learning method provided by the embodiment of the present invention is only an optional implementation manner, and cannot be limited thereto. this invention.
  • Step S206 forwarding the data packet according to the Layer 3 forwarding entry.
  • the generated Layer 3 forwarding entry is sent to the hardware, and the data packet can be forwarded according to the Layer 3 forwarding entry. It should be noted that how the network device forwards the data packet according to the Layer 3 forwarding entry is in the field. The technical personnel can understand that the data packet can be forwarded according to the matching table in the first matching table in the prior art, and details are not described herein again.
  • the network device when the network device detects that there is no entry matching the received data packet in the first matching table, the local physical address and the destination physical address of the data packet are obtained, and the service is determined. If the local physical address and the destination physical address are different, the data packet is a Layer 2 service, and the second matching table is used to search for an entry matching the physical address and the destination physical address, and a Layer 2 forwarding entry is generated. Forwarding the data packet according to the Layer 2 forwarding entry; if the local physical address is the same as the physical address of the destination, the data packet is a Layer 3 service, and the IP address and the destination IP address of the data packet are searched from the second matching table.
  • the matching entry is generated, and a Layer 3 forwarding entry is generated, and the data packet is forwarded according to the Layer 3 forwarding entry, so that the forwarding rule learned by the software layer matches the new data packet, thereby improving the processing efficiency of the new data packet. And, in turn, improved network performance.
  • FIG. 3 is a schematic flowchart of a method for processing a layer 2 service according to a second embodiment of the present invention.
  • the method provided in this embodiment is based on an entry that does not match a received data packet in the first matching table. And if the local physical address is determined to be inconsistent with the destination physical address of the data packet, the method in this embodiment as shown in FIG. 3 may include:
  • step S301 an entry matching the physical address and the destination physical address of the data packet is searched from the second matching table, and a Layer 2 forwarding entry is generated according to the entry matching the destination physical address.
  • Step S302 Forward the data packet according to the Layer 2 forwarding entry.
  • Step S303 Save the Layer 2 forwarding entry to the first matching table.
  • Step S304 Obtain an index number of the layer 2 forwarding entry in the first matching table.
  • the index number is the location of the layer 2 forwarding entry in the first matching table, and the specific representation of the index number is not limited in the present invention.
  • Step S305 generating a report message, and sending the report message to the controller, where the report message includes the index number and the data packet, so that the controller generates a forwarding entry generation instruction according to the data packet.
  • the forwarding entry generation instruction includes the index number
  • the report message may be a packed in message, and the report message may include a reason field in addition to the index number of the layer 2 forwarding entry in the first matching table and the data packet, where the reason is "post-reporting";
  • the network device sends the generated report message to a controller, so that the controller generates a forwarding entry generation instruction according to the data packet.
  • Step S306 receiving the forwarding entry generation instruction sent by the controller, and searching for the Layer 2 forwarding entry from the first matching table according to the index number in the forwarding entry generation instruction.
  • Step S307 determining whether the Layer 2 forwarding entry and the forwarding entry generating instruction indicate whether the generated forwarding entry is the same; if the Layer 2 forwarding entry and the forwarding entry generating instruction indicate the generated forwarding entry If not, proceed to step S308; otherwise, the process ends.
  • Step S308 modifying the Layer 2 forwarding entry in the first matching table according to the forwarding entry generation instruction.
  • communication data is first sliced and encapsulated into a plurality of data packets at a source host node, and the network device may continuously route the plurality of data packets.
  • the network device may further save the generated Layer 2 forwarding entry.
  • the matching entry can be directly queried in the first matching table, and the overall processing efficiency of the communication data is improved compared with the previous embodiment;
  • the network device may report the event to the controller, and if the controller indicates that the generated forwarding entry is different from the Layer 2 forwarding entry, the network device may further modify the second according to the forwarding entry generation instruction. Layer forwarding entries improve the accuracy of routing.
  • FIG. 4 is a schematic flowchart of another method for processing a Layer 2 service according to a third embodiment of the present invention.
  • the method provided in this embodiment is based on an entry that does not match the received data packet in the first matching table. And performing, if the local physical address is different from the destination physical address of the data packet, as shown in FIG. 4, the method in this embodiment may include:
  • Step S401 Searching, in the second matching table, an entry matching the physical address and the destination physical address of the data packet, and generating a Layer 2 forwarding entry according to the entry matching the destination physical address.
  • Step S402 forwarding the data packet according to the Layer 2 forwarding entry.
  • Step S403 Save the Layer 2 forwarding entry to a physical address table of the first matching table.
  • Step S404 Obtain an index number of the layer 2 forwarding entry in the first matching table.
  • Step S405 generating a report message, and sending the report message and the layer 2 forwarding entry to the controller, where the report message includes the index number and the data packet, so that the controller is configured according to the The data packet generates a forwarding entry generation instruction;
  • the report message may be a packed in message, and the report message may include a reason field in addition to the index number of the layer 2 forwarding entry in the first matching table and the data packet, where the reason is "Report afterwards.”
  • Step S406 the receiving, by the controller, the forwarding entry generation instruction sent when the forwarding entry generated by the forwarding entry generation instruction indicates that the forwarding entry is different from the Layer 2 forwarding entry, and the forwarding entry is generated.
  • the instruction includes the index number.
  • Step S407 searching for the Layer 2 forwarding entry from the first matching table according to the index number in the forwarding entry generation instruction, and modifying the first matching table according to the forwarding entry generation instruction.
  • the network device may further save the generated Layer 2 forwarding entry to the first matching table, and when the subsequent data packet is received, the matching entry may be directly queried in the first matching table, compared to the first embodiment. , improving the overall processing efficiency of communication data;
  • the network device may send the generated Layer 2 forwarding entry to the controller, and the controller determines whether the forwarding entry and the Layer 2 forwarding entry generated according to the received data packet indication are the same. If the process is not the same, the network device may receive the forwarding entry generation command sent by the controller, and directly modify the layer 2 forwarding entry according to the forwarding entry generation instruction, thereby improving the accuracy of the route.
  • FIG. 5 is a schematic flowchart of a method for processing a three-layer service according to a fourth embodiment of the present invention.
  • the method provided in this embodiment is based on an entry that does not match a received data packet in the first matching table. And if the local physical address is determined to be the same as the destination physical address of the data packet, the method in this embodiment, as shown in FIG. 5, may include:
  • Step S501 Obtain a destination IP address of the data packet, and find an entry matching the destination IP address from the second matching table, and generate a Layer 3 forwarding entry according to the entry matched by the destination IP address.
  • Step S502 Forward the data packet according to the Layer 3 forwarding entry.
  • Step S503 Save the Layer 3 forwarding entry to the first matching table.
  • Step S504 Obtain an index number of the third-layer forwarding entry in the first matching table.
  • the index number is the location of the Layer 3 forwarding entry in the first matching table.
  • the specific representation of the index number is not limited in the present invention.
  • Step S505 generating a report message, and sending the report message to the controller, where the report message includes the index number and the data packet, so that the controller generates a forwarding entry generation instruction according to the data packet.
  • the forwarding entry generation instruction includes the index number
  • the report message may be a packed in message, and the report message may include a reason field in addition to the index number of the layer 3 forwarding entry in the first matching table and the data packet, where the reason is "post-reporting";
  • the data packet sending, by the network device, the generated report message to a controller, so that the controller is based on the controller
  • the data packet generates a forwarding entry generation instruction.
  • Step S506 Receive the forwarding entry generation instruction sent by the controller, and search for the Layer 3 forwarding entry from the first matching table according to the index number in the forwarding entry generation instruction.
  • Step S507 determining whether the three-layer forwarding entry and the forwarding entry generating instruction indicate whether the generated forwarding entry is the same; if the three-layer forwarding entry and the forwarding entry generating instruction indicate the generated forwarding table If the items are different, step S308 is performed; otherwise, the flow is ended.
  • Step S508 Modify the Layer 3 forwarding entry in the first matching table according to the forwarding entry generation instruction.
  • the network device in the case where there is no entry matching the received data packet in the first matching table, and the local physical address is determined to be the same as the destination physical address of the data packet, the network device Further, the generated three-layer forwarding entry may be saved in the first matching table. When the subsequent data packet is received, the matched matching entry may be directly queried in the first matching table, which is improved compared with the previous embodiment. The overall processing efficiency of the communication data;
  • the network device may report the event to the controller. If the forwarding entry indicated by the controller for the data packet is different from the Layer 3 forwarding entry, the network device may further modify the third layer according to the forwarding entry generation instruction. Forwarding entries improves the accuracy of routing.
  • FIG. 6 is a schematic flowchart of another method for processing a three-layer service according to a fifth embodiment of the present invention.
  • the method provided in this embodiment is based on an entry that does not match the received data packet in the first matching table. And performing, if the local physical address is the same as the destination physical address of the data packet, the method in this embodiment as shown in FIG. 6 may include:
  • Step S601 Acquire a destination IP address of the data packet, and find an entry matching the destination IP address from the second matching table, and generate a Layer 3 forwarding entry according to the entry matched by the destination IP address.
  • Step S602 forwarding the data packet according to the Layer 3 forwarding entry.
  • Step S603 Save the Layer 3 forwarding entry to the first matching table.
  • Step S604 Obtain an index number of the third-layer forwarding entry in the first matching table.
  • Step S605 generating a report message, and sending the report message and the layer 3 forwarding entry to the controller, where the report message includes the index number and the data packet, so that the controller is configured according to the The data packet generates a forwarding entry generation instruction;
  • the report message may be a packed in message, and the report message may include a reason field in addition to the index number of the layer 3 forwarding entry in the first matching table and the data packet, where the reason is "Report afterwards.”
  • Step S606 the receiving the forwarding entry generation instruction sent by the controller when determining that the forwarding entry generated by the forwarding entry generation instruction is different from the three-layer forwarding entry, and the forwarding entry is generated.
  • the instruction includes the index number.
  • Step S607 searching for the Layer 3 forwarding entry from the first matching table according to the index number in the forwarding entry generation instruction, and modifying the first matching table according to the forwarding entry generation instruction.
  • the network device in the case where there is no entry matching the received data packet in the first matching table, and the local physical address is determined to be the same as the destination physical address of the data packet, the network device The generated Layer 3 forwarding entry may be saved in the first matching table.
  • the matching entry may be directly queried in the first matching table, which is improved compared with the first embodiment.
  • the overall processing efficiency of the communication data
  • the network device may send the generated Layer 3 forwarding entry to the controller, and the controller determines whether the forwarding entry and the Layer 3 forwarding entry generated according to the received data packet indication are the same. If the process is not the same, the network device can receive the forwarding entry generation command sent by the controller, and directly update the Layer 3 forwarding entry according to the entry in the configuration information, thereby improving the accuracy of the route.
  • FIG. 7 is a schematic flowchart of another packet forwarding method according to a sixth embodiment of the present invention.
  • the method in this embodiment is different from the first embodiment in that, as shown in FIG. 7, the method in this embodiment is shown in FIG.
  • the steps S701-706 corresponding to the steps S201-S206 of the first embodiment the following steps are included:
  • Step S707 If there is no entry in the first matching table that matches the data packet, send the data packet to the controller, so that the controller generates a forwarding entry generation instruction.
  • Step S708 Receive the forwarding entry generation instruction sent by the controller, and generate a forwarding entry in the first matching table according to the forwarding entry generation instruction.
  • the data packet when there is no entry in the first matching table that matches the data packet, the data packet is sent to the controller, so that the controller sends the corresponding forwarding entry. And generating, according to the forwarding entry generation instruction, a forwarding entry in the first matching table, and when receiving the subsequent data packet, directly searching for the matching entry in the first matching table, Compared with the previous embodiment, the processing efficiency of the entire communication data is improved.
  • the third embodiment can exist simultaneously in the same embodiment as the fifth embodiment or the sixth embodiment, and the fourth embodiment is also in the same embodiment as the fifth embodiment or the sixth embodiment. It may be present at the same time, and in one embodiment, only one of the above embodiments may be combined with the prior art, and the present invention is not limited.
  • FIG. 8 is a schematic flowchart of a method for updating a matching table according to a seventh embodiment of the present invention. The method in this embodiment is described from the perspective of a controller. As shown in FIG. 8, the method in this embodiment may include :
  • Step S801 receiving a report message sent by the network device, where the report message includes the index number and the data packet;
  • the index number is a storage location of the forwarding entry that is generated by the network device in the second matching table, and the generated forwarding entry may be a Layer 2 forwarding entry or a Layer 3 forwarding entry.
  • Step S802 generating a forwarding entry generation instruction according to the data packet
  • controller generates the forwarding entry generation command according to the received data packet is understandable by those skilled in the art, and details are not described herein again.
  • Step S803 generating a forwarding entry generation instruction including the index number.
  • Step S804 the forwarding entry generation instruction is sent to the network device, so that the network device searches for the corresponding rotation from the first matching table according to the index number in the forwarding entry generation instruction. And the item is published, and when it is determined that the forwarding entry generated by the forwarding entry indicates that the generated forwarding entry is different from the corresponding forwarding entry, the corresponding forwarding entry is modified according to the forwarding entry generation instruction. Forward the entry.
  • the controller may further receive, by the network device, the inaccessible packet in the first matching table.
  • the data packet sent by the matching entry the controller generates a forwarding entry generation instruction according to the data packet, and sends the forwarding entry generation instruction to the network device, so that the network device generates the instruction according to the forwarding entry generation instruction. Forwarding the entry, and the generated forwarding entry exists in the first matching table;
  • controller may periodically send the second matching table to the network device, so that the network device periodically updates the second matching table stored by the local device of the network device;
  • the controller may also send the second matching table to the network device when receiving the update request sent by the network device for the second matching table.
  • FIG. 9 is a schematic flowchart of another method for updating a matching table according to an eighth embodiment of the present invention. The method in this embodiment is described from the perspective of a controller, as shown in FIG. Methods can include:
  • Step S901 receiving a report message and a forwarding entry sent by the network device, where the report message includes the index number and the data packet;
  • the index number is a storage location of the forwarding entry that is generated by the network device in the second matching table, and the generated forwarding entry may be a Layer 2 forwarding entry or a Layer 3 forwarding table.
  • the forwarding entry may be in the report message or may be independent of the report message.
  • Step S902 generating a forwarding entry generation instruction according to the data packet
  • controller generates the forwarding entry generation command according to the received data packet is understandable by those skilled in the art, and details are not described herein again.
  • Step S903 determining that the generated forwarding entry generation instruction indicates whether the generated forwarding entry and the received forwarding entry are the same; if they are the same, the process ends; otherwise, step S904 is performed.
  • Step S904 the forwarding entry generation instruction is sent to the network device, so that the network device searches for the corresponding rotation from the first matching table according to the index number in the forwarding entry generation instruction. And publishing the item, and modifying the found forwarding entry according to the forwarding entry generation instruction.
  • the controller may further receive the data packet sent by the network device when the first matching table does not query the entry matching the data packet, and the controller generates a forwarding entry generation instruction according to the data packet, and then the forwarding The publishing item generation instruction is sent to the network device, so that the network device generates a loading table entry according to the forwarding entry generation instruction, and the generated forwarding entry is stored in the first matching table;
  • controller may periodically send a second matching table to the network device to enable the network
  • the device periodically updates the second matching table stored on the local end of the network device
  • the controller may also send the second matching table to the network device when receiving the update request sent by the network device for the second matching table.
  • FIG. 10 is a schematic structural diagram of a network device according to a ninth embodiment of the present invention.
  • the self-learning function of the hardware layer of the network device is closed and used to maintain a first matching table, and the software layer of the network device is self-learning.
  • the function is enabled and used to maintain the second matching table.
  • the network device 10 may include at least a packet receiving module 1001, a service determining module 1002, a layer 2 service processing module 1003, and a packet forwarding module 1004, where:
  • the packet receiving module 1001 is configured to receive a data packet, and detect whether an entry matching the data packet exists in the first matching table;
  • the service judging module 1002 is configured to: if the entry that matches the data packet does not exist in the first matching table, obtain a local physical address and a destination physical address of the data packet, and determine the local physical address and Whether the destination physical address of the data packet is the same;
  • the Layer 2 service processing module 1003 is configured to: if the local physical address and the destination physical address are different, look up the entry in the second matching table that matches the physical address and the destination physical address, and according to the The entry matching the destination physical address generates a Layer 2 forwarding entry.
  • the network device 10 may further include a software learning module 1005, configured to record the data packet if there is no entry in the second matching table that matches the physical address of the destination physical address.
  • the source physical address, the VLAN identifier, and the input port number are in the physical address table of the second matching table.
  • the packet forwarding module 1004 is configured to forward the data packet according to the Layer 2 forwarding entry.
  • network device 10 may further include:
  • the Layer 3 service processing module 1006 is configured to acquire a destination IP address of the data packet, and find the destination IP address from the second matching table, if the local physical address and the destination physical address are the same. A matching entry is generated, and a Layer 3 forwarding entry is generated according to the entry matching the destination IP address.
  • the packet forwarding module 1004 is further configured to:
  • the software learning module 1005 can be specifically configured to:
  • the created entry is updated according to the routing result, and the status of the created entry is marked as "learned".
  • software learning module 1005 may specifically be used to:
  • the matching domain of the Layer 2 forwarding entry includes a destination physical address of the data packet and a virtual local area network (VLAN) VLAN identifier, and the instruction set of the Layer 2 forwarding entry includes an output port number.
  • VLAN virtual local area network
  • the matching field of the Layer 3 forwarding entry includes at least one of the following: an input port number, a destination physical address, a destination IP address, and a source IP address of the data packet, and the instruction set of the Layer 3 forwarding entry includes an output. Port number, TTL instruction, and physical address modification instructions.
  • the packet sending module 1004 is further configured to:
  • the network device 10 further includes:
  • the instruction receiving module 1007 is configured to receive the forwarding entry generation instruction sent by the controller, and generate a forwarding entry in the first matching table according to the forwarding entry generation instruction.
  • the Layer 2 service processing module 1003 can also be used to:
  • the network device 10 may further include:
  • An index number obtaining 1008, configured to obtain an index number of the second layer forwarding entry in the first matching table
  • a report message generating module 1009 configured to generate a report message
  • the report message sending module 1010 is configured to send the report message to the controller, where the report message includes the index number and the data packet, so that the controller generates and forwards according to the data packet.
  • An entry generation instruction where the forwarding entry generation instruction includes the index number;
  • the instruction receiving module 1007 is further configured to receive the forwarding entry generation instruction sent by the controller, and search for the second from the first matching table according to the index number in the forwarding entry generation instruction.
  • Layer forwarding entry
  • the entry determining module 1011 is configured to determine whether the forwarding entry generated by the Layer 2 forwarding entry and the forwarding entry generation instruction is the same;
  • the Layer 2 service processing module 1003 is further configured to:
  • the Layer 2 forwarding entry and the forwarding entry generating instruction indicate that the generated forwarding entry is different, the Layer 2 forwarding entry is modified according to the forwarding entry generation instruction.
  • the report message sending module 1010 is further configured to send the report message and the layer 2 forwarding entry to the controller, where the report message includes the index number and the data packet, so that the The controller generates a forwarding entry generation instruction according to the data packet;
  • the instruction receiving module 1007 is further configured to: receive, by the controller, the forwarding entry generation instruction that is sent when the forwarding entry generated by the forwarding entry generation instruction indicates that the forwarding entry is different from the Layer 2 forwarding entry,
  • the forwarding entry generation instruction includes the index number
  • the Layer 2 service processing module 1003 is further configured to:
  • the Layer 2 forwarding entry is described.
  • the network device 11 is a schematic structural diagram of another network device according to a tenth embodiment of the present invention. As shown in FIG. 11, the self-learning function of the hardware layer of the network device is closed and used to maintain a first matching table. The self-learning function of the learning module of the device is turned on and used to maintain a second matching table.
  • the network device 11 may include at least one processor 111, such as a CPU, at least one network interface 112, at least one communication bus 113, and a memory 114. Among them, the communication bus 113 is used to implement connection communication between these components.
  • the memory 114 may be a high speed RAM memory or a nonvolatile memory. (non-volatile memory), such as at least one disk storage. Optionally, the memory 114 may also be at least one storage device located away from the processor 111.
  • a set of program codes is stored in the memory 114, and the processor 111 is configured to call program code stored in the memory 114 for performing the following operations:
  • the entry matching the data packet does not exist in the first matching table, acquiring a local physical address and a destination physical address of the data packet, and determining the local physical address and a destination physics of the data packet Whether the addresses are the same;
  • the second matching table is used to search for an entry matching the physical address and the destination physical address, and generate a second layer according to the entry matching the destination physical address. Forwarding entry
  • the processor 111 may also perform the following operations:
  • the matching domain of the Layer 2 forwarding entry includes a destination physical address of the data packet and a virtual local area network (VLAN) VLAN identifier, and the instruction set of the Layer 2 forwarding entry includes an output port number.
  • VLAN virtual local area network
  • the matching field of the Layer 3 forwarding entry includes at least one of the following: an input port number, a destination physical address, a destination IP address, and a source IP address of the data packet, and the instruction set of the Layer 3 forwarding entry includes an output. Port number, TTL instruction, and physical address modification instructions.
  • the processor 111 may further perform the following operations:
  • the processor 111 calls the program code stored in the memory 114 to generate a Layer 2 forwarding entry according to the entry matched by the destination physical address, the following operations may also be performed:
  • the following operations may also be performed:
  • the index entry generation instruction includes the index number
  • the Layer 2 forwarding entry and the forwarding entry generating instruction indicate that the generated forwarding entry is different, the Layer 2 forwarding entry in the first matching table is modified according to the forwarding entry generation instruction. .
  • the processor 111 calls the program code stored in the memory 114 to save the layer 2 forwarding entry to the physical address table of the first matching table, the following operations may also be performed. :
  • the Layer 2 forwarding entry is described.
  • the second matching table includes a physical address table, if no object exists in the second matching table
  • the processor 111 can also perform the following operations on the same entry as the destination physical address:
  • the first matching table includes at least one of a routing table and an address resolution protocol ARP mapping table. If the entry matching the destination IP address does not exist in the second matching table, the processor 111 You can also do the following:
  • the created entry is updated according to the routing result, and the status of the created entry is marked as "learned".
  • processor 111 can also call the stored code in the memory to perform the following operations:
  • the embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores a program, and the program execution includes some or all of the steps in the method described in connection with FIG. 2 to FIG. 9 in the embodiment of the present invention.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明公开了一种数据包转发方法,包括:接收数据包,并检测第一匹配表中是否存在与该数据包匹配的表项;若不存在,则获取本地物理地址和该数据包的目的物理地址,并判断本地物理地址和该目的物理地址是否相同;若不相同,则从第二匹配表中查找物理地址与该目的物理地址匹配的表项,并根据所述目的物理地址匹配的表项生成二层转发表项;根据该二层转发表项转发该数据包。相应地,本发明还公开了一种网络设备。采用本发明,可以通过软件层学习到的转发规则对新数据包进行匹配,提高新数据包的处理效率,进而,提高网络性能。

Description

一种数据包转发方法和网络设备 技术领域
本发明涉及通信技术领域,尤其涉及一种数据包转发方法和网络设备。
背景技术
OpenFlow(开放流)就是将原本由交换机/路由器控制的数据包转发过程,转化为由Open Flow交换机(全称:OpenFlow Switch,简称:OFS)和OpenFlow控制服务器(全称:OpenFlow Controller,简称:OFC)来共同完成,从而实现了数据转发和路由控制的分离;
OFS维护流表(FlowTable),并且只按照FlowTable进行转发,FlowTable本身的生成、维护以及下发完全由OFC来实现;具体的,OFS可以接收OFC所下发的流规则,并将其存储在FlowTable中,该FlowTable可以为多个流表,每个流表包括多个表项,每个表项即为一个流规则,该表项如图1所示可以包括匹配域(Match Field)、计数器(counters)和指令集(actions),其中,匹配域用来与接收到的数据包进行匹配,计数器记录了该表项与数据包匹配的统计信息,指令集决定如何转发数据包。
目前,在SDN(英文:Software Defined Network,中文:软件定义网络)模式下,为了便于管理,OFS的硬件学习和流表管理功能都是关闭的,当OFS针对接收到的数据包无法找到对应的转发规则时,则把该数据包转发给OFC,由OFC决定该包的转发动作,并下发新的转发规则到OFS,OFS再根据该转发规则转发该数据包;
现有技术的缺点:对于OFS接收到的新数据包(即通过查询FlowTable无法找到其对应的转发规则的数据包),都由OFC进行判决,降低了新数据包的处理效率;并且若OFS与OFC的链接中断,OFS更是无法处理接收到的新数据包,降低了网络性能。
发明内容
本发明提供了一种数据包转发方法和网络设备,可以通过软件层学习到的 转发规则对新数据包进行匹配,提高新数据包的处理效率,进而,提高网络性能。
本发明第一方面提供了一种数据包转发方法,所述数据包转发方法应用于网络设备,所述网络设备的硬件层的自我学习功能关闭且用于维护第一匹配表,所述网络设备的软件层的自我学习功能开启且用于维护第二匹配表,所述方法包括:
接收数据包,并检测所述第一匹配表中是否存在与所述数据包匹配的表项;
若所述第一匹配表中不存在与所述数据包匹配的表项,则获取本地物理地址和所述数据包的目的物理地址,并判断所述本地物理地址和所述数据包的目的物理地址是否相同;
若所述本地物理地址和所述目的物理地址不相同,则从所述第二匹配表中查找物理地址与所述目的物理地址匹配的表项,并根据所述目的物理地址匹配的表项生成二层转发表项;
根据所述二层转发表项转发所述数据包。
在第一方面的第一种可能实现方式中,若所述本地物理地址和所述目的物理地址相同,所述方法还包括:
获取所述数据包的目的IP地址,并从所述第二匹配表中查找与所述目的IP地址匹配的表项,并根据所述目的IP地址匹配的表项生成三层转发表项;
根据所述三层转发表项转发所述数据包。
结合第一方面的第一种可能实现方式,在第二种可能实现方式中,
所述二层转发表项的匹配域包括所述数据包的目的物理地址和虚拟局域网VLAN标识,所述二层转发表项的指令集包括输出端口号;
所述三层转发表项的匹配域包括至少一个以下匹配项:所述数据包的输入端口号、目的物理地址、目的IP地址和源IP地址,所述三层转发表项的指令集包括输出端口号、减TTL指令和修改物理地址指令。
结合第一方面以及第一方面的第一种至第二种中任一种可能实现方式,在第三种可能实现方式中,若所述第一匹配表中不存在与所述数据包匹配的表项,所述方法还包括:
将所述数据包发送至控制器,以使所述控制器生成转发表项生成指令;
接收所述控制器发送的所述转发表项生成指令,并根据所述转发表项生成指令在所述第一匹配表中生成转发表项。
在第一方面的第四种可能实现方式中,所述第一匹配表包括物理地址表,所述根据所述目的物理地址匹配的表项生成二层转发表项之后,所述方法还包括:
将所述二层转发表项保存到所述第一匹配表的物理地址表中。
结合第一方面的第四种可能实现方式,在第五种可能实现方式中,所述将所述二层转发表项保存到所述第一匹配表的物理地址表中之后,所述方法还包括:
获取所述二层转发表项在所述第一匹配表的索引号;
生成报告消息,并将所述报告消息发送至控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令,所述转发表项生成指令中所述索引号;
接收所述控制器发送的所述转发表项生成指令,并根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述二层转发表项;
判断所述二层转发表项和所述转发表项生成指令指示生成的转发表项是否相同;
若所述二层转发表项和所述转发表项生成指令指示生成的转发表项不相同,则根据所述转发表项生成指令修改所述二层转发表项。
结合第一方面的第四种可能实现方式,在第六种可能实现方式中,所述将所述二层转发表项保存到所述第一匹配表的物理地址表中之后,所述方法还包括:
获取所述二层转发表项在所述第一匹配表的索引号;
生成报告消息,并将所述报告消息和所述二层转发表项发送给控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令;
接收所述控制器在判定所述转发表项生成指令指示生成的转发表项与所述二层转发表项不相同时发送的所述转发表项生成指令,所述转发表项生成指 令包括所述索引号;
根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述二层转发表项,并根据所述转发表项生成指令修改所述二层转发表项。
在第一方面的第七中可能实现方式中,所述第二匹配表包括物理地址表,若所述第二匹配表中不存在物理地址与所述目的物理地址相同的表项,所述方法还包括:
记录所述数据包的源物理地址、VLAN标识以及输入端口号到所述第二匹配表的物理地址表中。
结合第一方面的第一种可能实现方式,在第八种可能实现方式中,所述第一匹配表包括路由表和地址解析协议ARP映射表中的至少一种,若所述第二匹配表中不存在与所述目的IP地址匹配的表项,所述方法还包括:
根据所述数据包的首部信息在所述第二匹配表中创建新的表项,并将创建的所述表项标注为“学习中”;
通过路由协议对接收的所述数据包进行路由;
根据路由结果更新创建的所述表项,并且将创建的所述表项的状态标注为“已学习”。
结合第一方面以及第一方面的第一种至第八种中任一种可能实现方式,在第九种可能实现方式中,所述方法包括:
接收所述控制器下发的至少一个表项,并将所述至少一个表项保存到所述第二匹配表中。
本发明第二方面提供了一种网络设备,所述网络设备的硬件层的自我学习功能关闭且用于维护第一匹配表,所述网络设备的软件层的自我学习功能开启且用于维护第二匹配表,所述网络设备包括:
包接收模块,用于接收数据包,并检测所述第一匹配表中是否存在与所述数据包匹配的表项;
业务判断模块,用于若所述第一匹配表中不存在与所述数据包匹配的表项,则获取本地物理地址和所述数据包的目的物理地址,并判断所述本地物理地址和所述数据包的目的物理地址是否相同;
二层业务处理模块,用于若所述本地物理地址和所述目的物理地址不相 同,则从所述第二匹配表中查找物理地址与所述目的物理地址匹配的表项,并根据所述目的物理地址匹配的表项生成二层转发表项;
包转发模块,用于根据所述二层转发表项转发所述数据包。
在第二方面的第一种可能实现方式中,所述网络设备还包括:
三层业务处理模块,用于若所述本地物理地址和所述目的物理地址相同,则获取所述数据包的目的IP地址,并从所述第二匹配表中查找与所述目的IP地址匹配的表项,并根据所述目的IP地址匹配的表项生成三层转发表项;
所述包转发模块还用于:
根据所述三层转发表项转发所述数据包。
结合第二方面的第一种可能实现方式,在第二种可能实现方式中,
所述二层转发表项的匹配域包括所述数据包的目的物理地址和虚拟局域网VLAN标识,所述二层转发表项的指令集包括输出端口号;
所述三层转发表项的匹配域包括至少一个以下匹配项:所述数据包的输入端口号、目的物理地址、目的IP地址和源IP地址,所述三层转发表项的指令集包括输出端口号、减TTL指令和修改物理地址指令。
结合第二方面以及第二方面的第一种至第二种中任一种可能实现方式,在第三种可能的实现方式中,所述包发送模块还用于:
若所述第一匹配表中不存在与所述数据包匹配的表项,则将所述数据包发送至控制器,以使所述控制器生成转发表项生成指令;
所述网络设备还包括:
指令接收模块,用于接收所述控制器发送的所述转发表项生成指令,并根据所述转发表项生成指令在所述第一匹配表中生成转发表项。
在第二方面的第四种可能实现方式中,所述第一匹配表包括物理地址表,所述二层业务处理模块还用于:
将所述二层转发表项保存到所述第一匹配表的物理地址表中。
结合第二方面的第四种可能实现方式,在第五种可能实现方式中,所述网络设备还包括:
索引号获取模块,用于获取所述二层转发表项在所述第一匹配表的索引号;
报告消息生成模块,用于生成报告消息;
报告消息发送模块,用于将所述报告消息发送至控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令,所述转发表项生成指令中包括所述索引号;
指令接收模块,用于接收所述控制器发送的所述配置信息转发表项生成指令,并根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述二层转发表项;
表项判断模块,用于判断所述二层转发表项和所述转发表项生成指令指示生成的转发表项是否相同;
所述二层业务处理模块还用于:
若所述二层转发表项和所述转发表项生成指令指示生成的转发表项不相同,则根据所述转发表项生成指令修改所述二层转发表项。
结合第二方面的第四种可能实现方式,在第六种可能实现方式中,所述网络设备还包括:
索引号获取模块,用于获取所述二层转发表项在所述第一匹配表的索引号;
报告消息生成模块,用于生成报告消息;
报告消息发送模块,用于将所述报告消息和所述二层转发表项发送给控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令;
指令接收模块,用于接收所述控制器在判定所述转发表项生成指令指示生成的转发表项与所述二层转发表项不相同时发送的所述转发表项生成指令,所述转发表项生成指令包括所述索引号;
所述二层业务处理模块还用于:
根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述二层转发表项,并根据所述转发表项生成指令修改所述二层转发表项。
在第二方面的第七中可能实现方式中,所述第二匹配表包括物理地址表,所述网络设备还包括:
软件学习模块,用于若所述第二匹配表中不存在物理地址与所述目的物理 地址相同的表项,则记录所述数据包的源物理地址、VLAN标识以及输入端口号到所述第二匹配表的物理地址表中。
结合第二方面的第一种可能实现方式,在第八种可能实现方式中,所述第一匹配表包括路由表和地址解析协议ARP映射表中的至少一种,所述网络设备还包括:
软件学习模块,用于:
若所述第二匹配表中不存在与所述目的IP地址匹配的表项,则根据所述数据包的首部信息在所述第二匹配表中创建新的表项,并将创建的所述表项标注为“学习中”;
通过路由协议对接收的所述数据包进行路由;
根据路由结果更新创建的所述表项,并且将创建的所述表项的状态标注为“已学习”。
在第二方面的第九种可能的实现方式中,所述网络设备还包括:
软件学习模块,用于接收所述控制器下发的至少一个表项,并将所述至少一个表项保存到所述第二匹配表中。
本发明三方面还提供一种网络设备,所述网络设备的硬件层的自我学习功能关闭且用于维护第一匹配表,所述网络设备的软件层的自我学习功能开启且用于维护第二匹配表,所述网络设备包括网络接口、存储器以及处理器,其中,所述存储器中存储一组程序,且处理器用于调用所述存储器中存储的程序,使得所述网络设备执行如第一方面提供的一种数据包转发方法的部分或全部步骤。
本发明第四方面还提供一种计算机存储介质,所述计算机存储介质存储有程序,所述程序执行时用于使计算机执行包括第一方面提供的一种数据包转发方法中的部分或全部步骤。
实施本发明,具有以下有益效果:
本发明中,当网络设备检测到第一匹配表中不存在与接收到的数据包匹配的表项时,则获取本地物理地址和数据包的目的物理地址进行业务判决,若本地物理地址和该目的物理地址不相同,则说明该数据包为二层业务,则从第二匹配表中查找物理地址与该目的物理地址相同的表项,并生成二层转发表项, 根据该二层转发表项转发该数据包,实现了通过软件层学习到的转发规则对新数据包进行匹配,提高了新数据包的处理效率,进而,提高了网络性能。
附图说明
为了更清楚地说明本发明实施例,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1示出了一种表项的结构示意图;
图2是本发明第一实施例提供的一种数据包转发方法的流程示意图;
图3是本发明第二实施例提供的一种二层业务处理方法的流程示意图;
图4是本发明第三实施例提供的另一种二层业务处理方法的流程示意图;
图5是本发明第四实施例提供的一种三层业务处理方法的流程示意图;
图6是本发明第五实施例提供的另一种三层业务处理方法的流程示意图;
图7是本发明第六实施例提供的另一种数据包转发方法的流程示意图;
图8是本发明第七实施例提供的一种匹配表的更新方法的流程示意图;
图9是本发明第八实施例提供的另一种匹配表的更新方法的流程示意图;
图10是本发明第九实施例提供的一种网络设备的结构示意图;
图11是本发明第十实施例提供的另一种网络设备的结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
在此部分,首先对本发明中各个实施例均涉及的一些基本概念进行说明。在TCP/IP参考模型和OSI参考模型中,对在模型的不同层的数据包有不同的称呼,比如帧、数据报文、分组等等,但为了方便起见,本发明统称为数据包。
本发明实施例提供的数据包转发方法应用于网络设备,如二层交换机、三 层交换机或路由器等,所述网络设备的硬件层的自我学习功能关闭且用于维护第一匹配表,即硬件层的学习模块不能对接收到的数据包进行学习,其第一匹配表中的各个表项是控制器下发的;所述网络设备的软件层的自我学习功能开启且用于维护第二匹配表,即软件层的学习模块可以对接收到的数据包进行学习,以更新第二匹配表,其中,软件层的学习模块如何进行自我学习请参照下述图3~图6对应的描述,在此不再赘述。
图2是本发明第一实施例提供的一种数据包转发方法的流程示意图,如图2所示所述方法可以包括:
步骤S201,接收数据包,并检测第一匹配表中是否存在与所述数据包匹配的表项;若第一匹配表中存在与所述数据包匹配的表项,则结束本流程;否则,执行步骤S202;
具体的,第一匹配表可以包括物理地址表、路由表和ARP(英文:Address Resolution Protocol,中文:地址解析协议)映射表中的至少一种,当网络设备接收到数据包时,可以先检测该数据包的业务类型,若该数据包为二层业务,则获取该数据包的目的物理地址,检测物理地址表是否存在物理地址和所述目的物理地址匹配的表项,若不存在,则说明第一匹配表中不存在与所述数据包匹配的表项,则执行步骤S202;若该数据包为三层业务,则获取该数据包的目的IP地址,将该目的IP地址与路由表的各个掩码进行按位“与”运算,若运算结果与对应的网络地址不相同,或者,检测其ARP映射表中是否存在IP地址与目的IP地址相同的表项,若不存在IP地址与目的IP地址相同的表项,则说明第一匹配表中不存在与所述数据包匹配的表项,则执行步骤S202。
步骤S202,获取本地物理地址和所述数据包的目的物理地址,并判断所述本地物理地址和所述数据包的目的物理地址是否相同;若所述本地物理地址和所述数据包的目的物理地址不相同,说明该数据包为二层业务,则执行二层业务的处理流程,即执行步骤S203;若所述本地物理地址和所述数据包的目的物理地址相同,说明该数据包为三层业务,则执行三层业务的处理流程,即执行步骤S205;
本发明实施例中,网络设备在检测到第一匹配表中不存在与所述数据包匹配的表项时,进一步将所述数据包与第二匹配表进行匹配,所述第二匹配表可 以是网络设备软件层维护的,该学习模块具有自我学习功能,第二匹配表中的表项比第一匹配表中的表项多,更有可能查询出与该数据包匹配的表项;相比现有技术,直接将该数据包发送至控制器,由控制器生成该数据包的转发规则而言,提高了新数据包的处理效率。
步骤S203,从第二匹配表中查找物理地址与所述目的物理地址匹配的表项,并根据所述目的物理地址匹配的表项生成二层转发表项;
所述第二匹配表包括物理地址表,对于二层业务,网络设备获取数据包的目的物理地址,查询第二匹配表的物理地址表中是否存在物理地址与该目的物理地址匹配的表项,若存在,则根据所述目的物理地址匹配的表项生成二层转发表项,所述二层转发表项的匹配域包括所述数据包的目的物理地址和虚拟局域网VLAN标识,所述二层转发表项的指令集包括输出端口号,所述输出端口号根据在第二匹配表中匹配的表项的输出端口号确定;
若所述第二匹配表中不存在物理地址与所述目的物理地址匹配的表项,网络设备还可以记录所述数据包的源物理地址、VLAN标识以及输入端口号到所述第二匹配表的物理地址表中;网络设备尽量对接收到的数据包进行学习,使第二匹配表中的物理地址表尽量多,可以提高数据包路由的成功率;假设,数据包A的源物理地址为11-22-33-44-55-66,目的物理地址为22-22-33-44-55-77,VLAN标识为11,通过网络设备的1号端口接入,网络设备检测到第二匹配表的物理地址表中不存在物理地址为22-22-33-44-55-77的表项,则在第二匹配表的物理地址表中创建新的表项,并将源物理地址、VLAN标识和输入端口号填入新建的所述表项中,当接收到目的物理地址为11-22-33-44-55-66的数据包时,则可以确定该数据包的转发规则,若没有记录数据包A的信息,当接收到目的物理地址为11-22-33-44-55-66的数据包时,也不能查询到该数据包的转发规则;
进一步的,网络设备还可以先检测所述第二匹配表中是否存在物理地址与该源物理地址匹配的表项,若不存在,再记录所述数据包的源物理地址、VLAN标识以及输入端口号到所述第二匹配表的物理地址表中,可以节约内存空间。
其中,网络设备还可以针对第二匹配表周期性地向控制器发送更新请求以更新本端存储的第二匹配表;控制器也可以周期性主动地向网络设备下发第二 匹配表,以更新网络设备本端存储的第二匹配表;
需要说明的是,若第二匹配表也不存在与该数据包匹配的表项,网络设备可以根据现有技术的处理方法,如丢去该数据包、通过默认输出端口转发等等处理所述数据包。
步骤S204,根据所述二层转发表项转发所述数据包;
将生成的所述二层转发表项下发到硬件,进而,可以根据该二层转发表项转发该数据包,需要说明的是,网络设备如何根据二层转发表项转发数据包是本领域技术人员可理解的,可以参考现有技术中根据在第一匹配表中匹配的表项转发数据包,在此不再赘述。
步骤S205,获取所述数据包的目的IP地址,并从所述第二匹配表中查找与所述目的IP地址匹配的表项,并根据所述目的IP地址匹配的表项生成三层转发表项;
所述第二匹配表包括路由表和ARP映射表中的至少一种,对于三层业务,网络设备获取数据包的目的IP地址,将该目的IP地址与路由表的各个掩码进行按位“与”运算,若运算结果与对应的网络地址相同,则根据其表项生成三层转发表项;或者,网络设备检测其ARP映射表中是否存在IP地址与目的IP地址相同的表项,若存在,则根据所述目的IP地址匹配的表项生成三层转发表项;
其中,所述三层转发表项的匹配域包括至少一个以下匹配项:所述数据包的输入端口号、目的物理地址、目的IP地址和源IP地址,所述三层转发表项的指令集包括输出端口号、减TTL指令和修改物理地址指令,所述输出端口号根据在第二匹配表中匹配的表项的输出端口号确定,所述减TTL指令用于减TTL,所述修改物理地址指令用于修改源物理地址和目的物理地址;可选的,所述三层转发表项还可以包括所述数据包的以太网类型;
若所述第二匹配表中不存在与所述目的IP地址匹配的表项,网络设备还可以根据所述数据包的首部信息在所述第二匹配表中创建新的表项,并将创建的所述表项标注为“学习中”,通过路由协议对接收的所述数据包进行路由,根据路由结果更新创建的所述表项,并且将创建的所述表项的状态标注为“已学习”。具体实现中,网络设备可以向其相邻的网络设备询问是否存在该数据 包的转发规则,若存在相邻的网络设备存在该数据包的转发规则,则根据其相邻的网络设备更新创建的所述表项,如根据该相邻的网络设备在本端网络设备的几号输出端口处确定所述输出端口号,再如根据该相邻的网络设备的物理地址确定目的物理地址等等,当更新了创建的所述表项后,再将该表项标识为“已学习”。
可理解的是,网络设备软件层的学习模块可以采用现有技术的学习方法对接收的数据包进行学习,本发明实施例提供的学习方法仅仅是一种可选的实施方式,不能以此限定本发明。
步骤S206,根据所述三层转发表项转发所述数据包;
将生成的所述三层转发表项下发到硬件,进而,可以根据该三层转发表项转发该数据包,需要说明的是,网络设备如何根据三层转发表项转发数据包是本领域技术人员可理解的,可以参考现有技术中根据在第一匹配表中匹配的表项转发数据包,在此不再赘述;
在图2所示的实施例中,当网络设备检测到第一匹配表中不存在与接收到的数据包匹配的表项时,则获取本地物理地址和数据包的目的物理地址进行业务判决,若本地物理地址和该目的物理地址不相同,则说明该数据包为二层业务,则从第二匹配表中查找物理地址与该目的物理地址匹配的表项,并生成二层转发表项,根据该二层转发表项转发该数据包;若本地物理地址和该目的物理地址相同,则说明该数据包为三层业务,则从第二匹配表中查找IP地址与数据包的目的IP地址匹配的表项,并生成三层转发表项,根据该三层转发表项转发该数据包,实现了通过软件层学习到的转发规则对新数据包进行匹配,提高了新数据包的处理效率,进而,提高了网络性能。
图3是本发明第二实施例提供的一种二层业务处理方法的流程示意图,本实施例提供的所述方法是基于第一匹配表中不存在与接收到的数据包匹配的表项,且判定本地物理地址和所述数据包的目的物理地址不匹配的情况下执行的,如图3所示本实施例的所述方法可以包括:
步骤S301,从第二匹配表中查找物理地址与数据包的目的物理地址匹配的表项,并根据所述目的物理地址匹配的表项生成二层转发表项。
步骤S302,根据所述二层转发表项转发所述数据包。
步骤S303,将所述二层转发表项保存到第一匹配表中。
可理解的是,步骤S302-S303之间没有严格的先后执行顺序,也可以是同步执行。
步骤S304,获取所述二层转发表项在所述第一匹配表的索引号;
该索引号为该二层转发表项在该第一匹配表中的位置,该索引号的具体表示形式本发明不做限定。
步骤S305,生成报告消息,并将所述报告消息发送至控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令,所述转发表项生成指令中包括所述索引号;
所述报告消息可以为packed in消息,所述报告消息除了包括所述二层转发表项在所述第一匹配表中的索引号以及所述数据包以外,还可以包括reason字段,该reason为“事后上报”;
所述网络设备将生成的所述报告消息发送至控制器,以使所述控制器根据所述数据包生成转发表项生成指令。
步骤S306,接收所述控制器发送的所述转发表项生成指令,并根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述二层转发表项。
步骤S307,判断所述二层转发表项和所述转发表项生成指令指示生成的转发表项是否相同;若所述二层转发表项和所述转发表项生成指令指示生成的转发表项不相同,则执行步骤S308;否则,则结束本流程。
步骤S308,根据所述转发表项生成指令修改所述第一匹配表中的所述二层转发表项。
在包交换网络中,通信数据首先在源主机节点被切分和封装成多个数据包,则网络设备可能连续为所述多个数据包路由,在图3所示的实施例中,在第一匹配表中不存在与接收到的数据包匹配的表项,且判定本地物理地址和所述数据包的目的物理地址不相同的情况下,网络设备进一步可以将生成的二层转发表项保存到第一匹配表中,当接收到后续的数据包时,可以在第一匹配表中直接查询到匹配的表项,相比上一实施例,提高了通信数据整体的处理效率;
进一步的,网络设备还可以将本事件上报控制器,若控制器针对该数据包指示生成的转发表项与该二层转发表项不相同,网络设备还可以根据转发表项生成指令修改该二层转发表项,提高了路由的准确率。
图4是本发明第三实施例提供的另一种二层业务处理方法的流程示意图,本实施例提供的所述方法是基于第一匹配表中不存在与接收到的数据包匹配的表项,且判定本地物理地址和所述数据包的目的物理地址不相同的情况下执行的,如图4所示本实施例的所述方法可以包括:
步骤S401,从第二匹配表中查找物理地址与数据包的目的物理地址匹配的表项,并根据所述目的物理地址匹配的表项生成二层转发表项。
步骤S402,根据所述二层转发表项转发所述数据包。
步骤S403,将所述二层转发表项保存到第一匹配表的物理地址表中。
可理解的是,步骤S402-S403之间没有严格的先后执行顺序,也可以是同步执行。
步骤S404,获取所述二层转发表项在所述第一匹配表的索引号。
步骤S405,生成报告消息,并将所述报告消息和所述二层转发表项发送给控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令;
所述报告消息可以为packed in消息,所述报告消息除了包括所述二层转发表项在所述第一匹配表中的索引号以及所述数据包以外,还可以包括reason字段,该reason为“事后上报”。
步骤S406,接收所述控制器在判定所述转发表项生成指令指示生成的转发表项与所述二层转发表项不相同时发送的所述转发表项生成指令,所述转发表项生成指令包括所述索引号。
步骤S407,根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述二层转发表项,并根据所述转发表项生成指令修改所述第一匹配表中的所述二层转发表项。
在图4所示的实施例中,在第一匹配表中不存在与接收到的数据包匹配的表项,且判定本地物理地址和所述数据包的目的物理地址不相同的情况下,网 络设备进一步可以将生成的二层转发表项保存到第一匹配表中,当接收到后续的数据包时,可以在第一匹配表中直接查询到匹配的表项,相比第一实施例,提高了通信数据整体的处理效率;
进一步的,网络设备还可以将生成的二层转发表项发送至控制器,由控制器判断根据接收的数据包指示生成的转发表项和二层转发表项是否相同,若相同,则结束本流程;若不相同,所述网络设备可以接收到该控制器下发的转发表项生成指令,并直接根据该转发表项生成指令修改二层转发表项,提高了路由的准确率。
图5是本发明第四实施例提供的一种三层业务处理方法的流程示意图,本实施例提供的所述方法是基于第一匹配表中不存在与接收到的数据包匹配的表项,且判定本地物理地址和所述数据包的目的物理地址相同的情况下执行的,如图5所示本实施例的所述方法可以包括:
步骤S501,获取数据包的目的IP地址,并从第二匹配表中查找与所述目的IP地址匹配的表项,并根据所述目的IP地址匹配的表项生成三层转发表项。
步骤S502,根据所述三层转发表项转发所述数据包。
步骤S503,将所述三层转发表项保存到第一匹配表中。
可理解的是,步骤S502-S503之间没有严格的先后执行顺序,也可以是同步执行。
步骤S504,获取所述三层转发表项在所述第一匹配表的索引号;
该索引号为该三层转发表项在该第一匹配表中的位置,该索引号的具体表示形式本发明不做限定。
步骤S505,生成报告消息,并将所述报告消息发送至控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令,所述转发表项生成指令包括所述索引号;
所述报告消息可以为packed in消息,所述报告消息除了包括所述三层转发表项在所述第一匹配表中的索引号以及所述数据包以外,还可以包括reason字段,该reason为“事后上报”;
所述网络设备将生成的所述报告消息发送至控制器,以使所述控制器根据 所述数据包生成转发表项生成指令。
步骤S506,接收所述控制器发送的所述转发表项生成指令,并根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述三层转发表项。
步骤S507,判断所述三层转发表项和所述转发表项生成指令指示生成的的转发表项是否相同;若所述三层转发表项和所述转发表项生成指令指示生成的转发表项不相同,则执行步骤S308;否则,则结束本流程。
步骤S508,根据所述转发表项生成指令修改所述第一匹配表中的所述三层转发表项。
在图5所示的实施例中,在第一匹配表中不存在与接收到的数据包匹配的表项,且判定本地物理地址和所述数据包的目的物理地址相同的情况下,网络设备进一步可以将生成的三层转发表项保存到第一匹配表中,当接收到后续的数据包时,可以在第一匹配表中直接查询到匹配的表项,相比上一实施例,提高了通信数据整体的处理效率;
进一步的,网络设备还可以将本事件上报控制器,若控制器针对该数据包指示的转发表项与该三层转发表项不相同,网络设备还可以根据转发表项生成指令修改该三层转发表项,提高了路由的准确率。
图6是本发明第五实施例提供的另一种三层业务处理方法的流程示意图,本实施例提供的所述方法是基于第一匹配表中不存在与接收到的数据包匹配的表项,且判定本地物理地址和所述数据包的目的物理地址相同的情况下执行的,如图6所示本实施例的所述方法可以包括:
步骤S601,获取数据包的目的IP地址,并从第二匹配表中查找与所述目的IP地址匹配的表项,并根据所述目的IP地址匹配的表项生成三层转发表项。
步骤S602,根据所述三层转发表项转发所述数据包。
步骤S603,将所述三层转发表项保存到第一匹配表中。
可理解的是,步骤S602-S603之间没有严格的先后执行顺序,也可以是同步执行。
步骤S604,获取所述三层转发表项在所述第一匹配表的索引号。
步骤S605,生成报告消息,并将所述报告消息和所述三层转发表项发送给控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令;
所述报告消息可以为packed in消息,所述报告消息除了包括所述三层转发表项在所述第一匹配表中的索引号以及所述数据包以外,还可以包括reason字段,该reason为“事后上报”。
步骤S606,接收所述控制器在判定所述转发表项生成指令指示生成的转发表项与所述三层转发表项不相同时发送的所述转发表项生成指令,所述转发表项生成指令包括所述索引号。
步骤S607,根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述三层转发表项,并根据所述转发表项生成指令修改所述第一匹配表中的所述三层转发表项。
在图6所示的实施例中,在第一匹配表中不存在与接收到的数据包匹配的表项,且判定本地物理地址和所述数据包的目的物理地址相同的情况下,网络设备进一步可以将生成的三层转发表项保存到第一匹配表中,当接收到后续的数据包时,可以在第一匹配表中直接查询到匹配的表项,相比第一实施例,提高了通信数据整体的处理效率;
进一步的,网络设备还可以将生成的三层转发表项发送至控制器,由控制器判断根据接收的数据包指示生成的转发表项和三层转发表项是否相同,若相同,则结束本流程;若不相同,所述网络设备可以接收到该控制器下发的转发表项生成指令,并直接根据该配置信息中的表项更新三层转发表项,提高了路由的准确率。
图7是本发明第六实施例提供的另一种数据包转发方法的流程示意图,本实施例的所述方法与第一实施例区别在于,如图7所示,本实施例的所述方法除了包括与第一实施例步骤S201~S206对应的步骤S701~706之外,还包括以下步骤:
步骤S707,若所述第一匹配表中不存在与所述数据包匹配的表项,则将所述数据包发送至控制器,以使所述控制器生成转发表项生成指令;
步骤S708,接收所述控制器发送的所述转发表项生成指令,并根据所述转发表项生成指令在所述第一匹配表中生成转发表项。
在图7所示的实施例中,当第一匹配表中不存在与数据包匹配的表项时,则将所述数据包发送给控制器,以使控制器下发对应的转发表项生成指令,并将根据所述转发表项生成指令在所述第一匹配表中生成转发表项,当接收到后续的数据包时,可以在第一匹配表中直接查询到匹配的表项,相比上一实施例,提高了通信数据整体的处理效率。
可理解的是,第三实施例与第五实施例或第六实施例在同一个实施例中可以同时存在,第四实施例与第五实施例或第六实施例在同一个实施例中也可以同时存在,也可以在一个实施例中只采用上述中的任一实施例与现有技术相结合的情况,本发明不限定。
图8是本发明第七实施例提供的匹配表的更新方法的流程示意图,本实施例的所述方法是从控制器角度描述的,如图8所示,本实施例的所述方法可以包括:
步骤S801,接收网络设备发送的报告消息,所述报告消息包括所述索引号和所述数据包;
所述索引号为网络设备生产的转发表项在第二匹配表中的存储位置,生成的所述转发表项可以是二层转发表项或三层转发表项。
步骤S802,根据所述数据包生成转发表项生成指令;
可理解的是,控制器如何根据接收的数据包生成转发表项生成指令是本领域技术人员可理解的,在此不再赘述。
步骤S803,生成包括所述索引号的转发表项生成指令。
步骤S804,将所述转发表项生成指令发送至所述网络设备,以使所述网络设备根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找对应的转发表项,并在判定所述转发表项生成指令指示生成的转发表项与查找到的对应的所述转发表项不相同时,根据所述转发表项生成指令修改查找到的对应的所述转发表项。
进一步的,控制器还可以接收网络设备在第一匹配表中查询不到与数据包 匹配的表项时发送的该数据包,控制器根据该数据包生成转发表项生成指令,再将该转发表项生成指令发送给网络设备,以使网络设备根据所述转发表项生成指令生成转发表项,并将生成的所述转发表项存在第一匹配表中;
再进一步的,控制器可以周期性的向网络设备发送第二匹配表,以使网络设备定期更新网络设备本端存储的第二匹配表;
其中,控制器也可以在接收网络设备针对第二匹配表发送的更新请求时,才向该网络设备发送第二匹配表。
图9是本发明第八实施例提供的另一种匹配表的更新方法的流程示意图,本实施例的所述方法是从控制器角度描述的,如图9所示,本实施例的所述方法可以包括:
步骤S901,接收网络设备发送的报告消息和转发表项,所述报告消息包括所述索引号和所述数据包;
所述索引号为网络设备生产的所述转发表项在第二匹配表中的存储位置,生成的所述转发表项可以是二层转发表项或三层转发表;
其中,该转发表项可以在所述报告消息中,也可以独立于所述报告消息。
步骤S902,根据所述数据包生成转发表项生成指令;
可理解的是,控制器如何根据接收的数据包生成转发表项生成指令是本领域技术人员可理解的,在此不再赘述。
步骤S903,判断生成的所述转发表项生成指令指示生成的转发表项和接收的所述转发表项是否相同;若相同,则结束本流程;否则执行步骤S904。
步骤S904,将所述转发表项生成指令发送至所述网络设备,以使所述网络设备根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找对应的转发表项,并根据所述转发表项生成指令修改查找到的所述转发表项。
进一步的,控制器还可以接收网络设备在第一匹配表中查询不到与数据包匹配的表项时发送的该数据包,控制器根据该数据包生成转发表项生成指令,再将该转发表项生成指令发送给网络设备,以使网络设备根据所述转发表项生成指令生成装法表项,并将生成的所述转发表项存在第一匹配表中;
再进一步的,控制器可以周期性的向网络设备发送第二匹配表,以使网络 设备定期更新网络设备本端存储的第二匹配表;
其中,控制器也可以在接收网络设备针对第二匹配表发送的更新请求时,才向该网络设备发送第二匹配表。
图10是本发明第九实施例提供的一种网络设备的结构示意图,所述网络设备的硬件层的自我学习功能关闭且用于维护第一匹配表,所述网络设备的软件层的自我学习功能开启且用于维护第二匹配表,如图10所示,所述网络设备10至少可以包括:包接收模块1001、业务判断模块1002、二层业务处理模块1003以及包转发模块1004,其中:
包接收模块1001,用于接收数据包,并检测所述第一匹配表中是否存在与所述数据包匹配的表项;
业务判断模块1002,用于若所述第一匹配表中不存在与所述数据包匹配的表项,则获取本地物理地址和所述数据包的目的物理地址,并判断所述本地物理地址和所述数据包的目的物理地址是否相同;
二层业务处理模块1003,用于若所述本地物理地址和所述目的物理地址不相同,则从所述第二匹配表中查找物理地址与所述目的物理地址匹配同的表项,并根据所述目的物理地址匹配的表项生成二层转发表项;
所述网络设备10如图10所示进一步可以包括软件学习模块1005,用于若所述第二匹配表中不存在物理地址与所述目的物理地址匹配的表项,则记录所述数据包的源物理地址、VLAN标识以及输入端口号到所述第二匹配表的物理地址表中。
包转发模块1004,用于根据所述二层转发表项转发所述数据包。
进一步的,所述网络设备10还可以包括:
三层业务处理模块1006,用于若所述本地物理地址和所述目的物理地址相同,则获取所述数据包的目的IP地址,并从所述第二匹配表中查找与所述目的IP地址匹配的表项,并根据所述目的IP地址匹配的表项生成三层转发表项;
所述包转发模块1004还用于:
根据所述三层转发表项转发所述数据包。
所述软件学习模块1005具体可以用于:
若所述第二匹配表中不存在与所述目的IP地址匹配的表项,则根据所述数据包的首部信息在所述第二匹配表中创建新的表项,并将创建的所述表项标注为“学习中”;
通过路由协议对接收的所述数据包进行路由;
根据路由结果更新创建的所述表项,并且将创建的所述表项的状态标注为“已学习”。
再进一步的,所述软件学习模块1005具体还可以用于:
接收所述控制器下发的至少一个表项,并将所述至少一个表项保存到所述第二匹配表中。
其中,所述二层转发表项的匹配域包括所述数据包的目的物理地址和虚拟局域网VLAN标识,所述二层转发表项的指令集包括输出端口号;
所述三层转发表项的匹配域包括至少一个以下匹配项:所述数据包的输入端口号、目的物理地址、目的IP地址和源IP地址,所述三层转发表项的指令集包括输出端口号、减TTL指令和修改物理地址指令。
可选的,所述包发送模块1004还用于:
若所述第一匹配表中不存在与所述数据包匹配的表项,则将所述数据包发送至控制器,以使所述控制器生成转发表项生成指令;
所述网络设备10还包括:
指令接收模块1007,用于接收所述控制器发送的所述转发表项生成指令,并根据所述转发表项生成指令在所述第一匹配表中生成转发表项。
其中,所述二层业务处理模块1003还可以用于:
将所述二层转发表项保存到所述第一匹配表的物理地址表中。
可选的,所述网络设备10还可以包括:
索引号获取1008,用于获取所述二层转发表项在所述第一匹配表的索引号;
报告消息生成模块1009,用于生成报告消息;
报告消息发送模块1010,用于将所述报告消息发送至控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发 表项生成指令,所述转发表项生成指令中包括所述索引号;
指令接收模块1007,还用于接收所述控制器发送的所述转发表项生成指令,并根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述二层转发表项;
表项判断模块1011,用于判断所述二层转发表项和所述转发表项生成指令指示生成的转发表项是否相同;
所述二层业务处理模块1003还用于:
若所述二层转发表项和所述转发表项生成指令指示生成的转发表项不相同,则根据所述转发表项生成指令修改所述二层转发表项。
进一步的,所述报告消息发送模块1010还用于,将所述报告消息和所述二层转发表项发送给控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令;
指令接收模块1007还用于,接收所述控制器在判定所述转发表项生成指令指示生成的转发表项与所述二层转发表项不相同时发送的所述转发表项生成指令,所述转发表项生成指令包括所述索引号;
所述二层业务处理模块1003还用于:
根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述二层转发表项,并根据所述转发表项生成指令修改所述第一匹配表中的所述二层转发表项。
可理解的是,本实施例的网络设备10的各功能模块的功能可根据上述方法实施例中的方法具体实现,可以具体对应参考图2或图8方法实施例的相关描述,此处不再赘述。
图11是本发明第十实施例提供的另一种网络设备的结构示意图,如图11所示,所述网络设备的硬件层的自我学习功能关闭且用于维护第一匹配表,所述网络设备的学习模块的自我学习功能开启且用于维护第二匹配表,该网络设备11可以包括:至少一个处理器111,例如CPU,至少一个网络接口112,至少一个通信总线113,存储器114。其中,通信总线113用于实现这些组件之间的连接通信。存储器114可以是高速RAM存储器,也可以是非易失的存储器 (non-volatile memory),例如至少一个磁盘存储器。可选的,存储器114还可以是至少一个位于远离前述处理器111的存储装置。存储器114中存储一组程序代码,且处理器111用于调用存储器114中存储的程序代码,用于执行以下操作:
通过所述网络接口接收数据包,并检测所述第一匹配表中是否存在与所述数据包匹配的表项;
若所述第一匹配表中不存在与所述数据包匹配的表项,则获取本地物理地址和所述数据包的目的物理地址,并判断所述本地物理地址和所述数据包的目的物理地址是否相同;
若所述本地物理地址和所述目的物理地址不相同,则从第二匹配表中查找物理地址与所述目的物理地址匹配的表项,并根据所述目的物理地址匹配的表项生成二层转发表项;
根据所述二层转发表项转发所述数据包。
若所述本地物理地址和所述目的物理地址相同,所述处理器111还可以执行以下操作:
获取所述数据包的目的IP地址,并从所述第二匹配表中查找与所述目的IP地址匹配的表项,并根据所述目的IP地址匹配的表项生成三层转发表项;
根据所述三层转发表项转发所述数据包。
其中,所述二层转发表项的匹配域包括所述数据包的目的物理地址和虚拟局域网VLAN标识,所述二层转发表项的指令集包括输出端口号;
所述三层转发表项的匹配域包括至少一个以下匹配项:所述数据包的输入端口号、目的物理地址、目的IP地址和源IP地址,所述三层转发表项的指令集包括输出端口号、减TTL指令和修改物理地址指令。
进一步的,若所述第一匹配表中不存在与所述数据包匹配的表项,所述处理器111还可以执行以下操作:
将所述数据包发送至控制器,以使所述控制器生成转发表项生成指令;
接收所述控制器发送的所述转发表项生成指令,并根据所述转发表项生成指令在所述第一匹配表中生成转发表项。
进一步的,处理器111调用存储器114中存储的程序代码根据所述目的物理地址匹配的表项生成二层转发表项之后,还可以执行以下操作:
将所述二层转发表项保存到所述第一匹配表的物理地址表中。
在一种可选的实施方式中,处理器111调用存储器114中存储的程序代码将所述二层转发表项保存到所述第一匹配表的物理地址表中之后,还可以执行以下操作:
获取所述二层转发表项在所述第一匹配表的索引号;
生成报告消息,并将所述报告消息发送至控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令,所述转发表项生成指令中包括所述索引号;
接收所述控制器发送的所述转发表项生成指令,并根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述二层转发表项;
判断所述二层转发表项和所述转发表项生成指令指示生成的转发表项是否相同;
若所述二层转发表项和所述转发表项生成指令指示生成的转发表项不相同,则根据所述转发表项生成指令修改所述第一匹配表中的所述二层转发表项。
在另一种可选的实施方式中,处理器111调用存储器114中存储的程序代码将所述二层转发表项保存到所述第一匹配表的物理地址表中之后,还可以执行以下操作:
获取所述二层转发表项在所述第一匹配表的索引号;
生成报告消息,并将所述报告消息和所述二层转发表项发送给控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令;
接收所述控制器在判定所述转发表项生成指令指示生成的转发表项与所述二层转发表项不相同时发送的所述转发表项生成指令,所述转发表项生成指令包括所述索引号;
根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述二层转发表项,并根据所述转发表项生成指令修改所述第一匹配表中的所述二层转发表项。
可选的,所述第二匹配表包括物理地址表,若所述第二匹配表中不存在物 理地址与所述目的物理地址相同的表项,处理器111还可以执行以下操作:
记录所述数据包的源物理地址、VLAN标识以及输入端口号到所述第二匹配表的物理地址表中。
可选的,所述第一匹配表包括路由表和地址解析协议ARP映射表中的至少一种,若所述第二匹配表中不存在与所述目的IP地址匹配的表项,处理器111还可以执行以下操作:
根据所述数据包的首部信息在所述第二匹配表中创建新的表项,并将创建的所述表项标注为“学习中”;
通过路由协议对接收的所述数据包进行路由;
根据路由结果更新创建的所述表项,并且将创建的所述表项的状态标注为“已学习”。
进一步的,处理器111还可以调用存储器中的存储代码执行以下操作:
接收所述控制器下发的至少一个表项,并将所述至少一个表项保存到所述第二匹配表中。
可理解的是,本实施例的网络设备11的各功能模块的功能可根据上述方法实施例中的方法具体实现,可以具体对应参考图2或图8方法实施例的相关描述,此处不再赘述。
本发明实施例还提出了一种计算机存储介质,所述计算机存储介质存储有程序,所述程序执行时包括本发明实施例结合图2~图9所描述的方法中的部分或全部的步骤。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
以上所揭露的仅为本发明较佳实施例而已,当然不能以此来限定本发明之权利范围,因此依本发明权利要求所作的等同变化,仍属本发明所涵盖的范围。

Claims (22)

  1. 一种数据包转发方法,其特征在于,所述数据包转发方法应用于网络设备,所述网络设备的硬件层的自我学习功能关闭且用于维护第一匹配表,所述网络设备的软件层的自我学习功能开启且用于维护第二匹配表,所述方法包括:
    接收数据包,并检测所述第一匹配表中是否存在与所述数据包匹配的表项;
    若所述第一匹配表中不存在与所述数据包匹配的表项,则获取本地物理地址和所述数据包的目的物理地址,并判断所述本地物理地址和所述数据包的目的物理地址是否相同;
    若所述本地物理地址和所述目的物理地址不相同,则从所述第二匹配表中查找物理地址与所述目的物理地址匹配的表项,并根据所述目的物理地址匹配的表项生成二层转发表项;
    根据所述二层转发表项转发所述数据包。
  2. 如权利要求1所述的方法,其特征在于,若所述本地物理地址和所述目的物理地址相同,所述方法还包括:
    获取所述数据包的目的IP地址,并从所述第二匹配表中查找与所述目的IP地址匹配的表项,并根据所述目的IP地址匹配的表项生成三层转发表项;
    根据所述三层转发表项转发所述数据包。
  3. 如权利要求2所述的方法,其特征在于,
    所述二层转发表项的匹配域包括所述数据包的目的物理地址和虚拟局域网VLAN标识,所述二层转发表项的指令集包括输出端口号;
    所述三层转发表项的匹配域包括至少一个以下匹配项:所述数据包的输入端口号、目的物理地址、目的IP地址和源IP地址,所述三层转发表项的指令集包括输出端口号、减TTL指令和修改物理地址指令。
  4. 如权利要求1-3任一项所述的方法,其特征在于,若所述第一匹配表中不存在与所述数据包匹配的表项,所述方法还包括:
    将所述数据包发送至控制器,以使所述控制器生成转发表项生成指令;
    接收所述控制器发送的所述转发表项生成指令,并根据所述转发表项生成指令在所述第一匹配表中生成转发表项。
  5. 如权利要求1所述的方法,其特征在于,所述第一匹配表包括物理地址表,所述根据所述目的物理地址匹配的表项生成二层转发表项之后,所述方法还包括:
    将所述二层转发表项保存到所述第一匹配表的物理地址表中。
  6. 如权利要求5所述的方法,其特征在于,所述将所述二层转发表项保存到所述第一匹配表的物理地址表中之后,所述方法还包括:
    获取所述二层转发表项在所述第一匹配表的索引号;
    生成报告消息,并将所述报告消息发送至控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令,所述转发表项生成指令中包括所述索引号;
    接收所述控制器发送的所述转发表项生成指令,并根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述二层转发表项;
    判断所述二层转发表项和所述转发表项生成指令指示生成的转发表项是否相同;
    若所述二层转发表项和所述转发表项生成指令指示生成的转发表项不相同,则根据所述转发表项生成指令修改所述第一匹配表中的所述二层转发表项。
  7. 如权利要求5所述的方法,其特征在于,所述将所述二层转发表项保存到所述第一匹配表的物理地址表中之后,所述方法还包括:
    获取所述二层转发表项在所述第一匹配表的索引号;
    生成报告消息,并将所述报告消息和所述二层转发表项发送给控制器,所 述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令;
    接收所述控制器在判定所述转发表项生成指令指示生成的转发表项与所述二层转发表项不相同时发送的所述转发表项生成指令,所述转发表项生成指令包括所述索引号;
    根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述二层转发表项,并根据所述转发表项生成指令修改所述第一匹配表中的所述二层转发表项。
  8. 如权利要求1所述的方法,其特征在于,所述第二匹配表包括物理地址表,若所述第二匹配表中不存在物理地址与所述目的物理地址相同的表项,所述方法还包括:
    记录所述数据包的源物理地址、VLAN标识以及输入端口号到所述第二匹配表的物理地址表中。
  9. 如权利要求2所述的方法,其特征在于,所述第一匹配表包括路由表和地址解析协议ARP映射表中的至少一种,若所述第二匹配表中不存在与所述目的IP地址匹配的表项,所述方法还包括:
    根据所述数据包的首部信息在所述第二匹配表中创建新的表项,并将创建的所述表项标注为“学习中”;
    通过路由协议对接收的所述数据包进行路由;
    根据路由结果更新创建的所述表项,并且将创建的所述表项的状态标注为“已学习”。
  10. 如权利要求1-9任一项所述的方法,其特征在于,所述方法包括:
    接收所述控制器下发的至少一个表项,并将所述至少一个表项保存到所述第二匹配表中。
  11. 一种网络设备,其特征在于,所述网络设备的硬件层的自我学习功能 关闭且用于维护第一匹配表,所述网络设备的软件层的自我学习功能开启且用于维护第二匹配表,所述网络设备包括:
    包接收模块,用于接收数据包,并检测所述第一匹配表中是否存在与所述数据包匹配的表项;
    业务判断模块,用于若所述第一匹配表中不存在与所述数据包匹配的表项,则获取本地物理地址和所述数据包的目的物理地址,并判断所述本地物理地址和所述数据包的目的物理地址是否相同;
    二层业务处理模块,用于若所述本地物理地址和所述目的物理地址不相同,则从所述第二匹配表中查找物理地址与所述目的物理地址匹配的表项,并根据所述目的物理地址匹配的表项生成二层转发表项;
    包转发模块,用于根据所述二层转发表项转发所述数据包。
  12. 如权利要求11所述的网络设备,其特征在于,所述网络设备还包括:
    三层业务处理模块,用于若所述本地物理地址和所述目的物理地址相同,则获取所述数据包的目的IP地址,并从所述第二匹配表中查找与所述目的IP地址匹配的表项,并根据所述目的IP地址匹配的表项生成三层转发表项;
    所述包转发模块还用于:
    根据所述三层转发表项转发所述数据包。
  13. 如权利要求12所述的网络设备,其特征在于,
    所述二层转发表项的匹配域包括所述数据包的目的物理地址和虚拟局域网VLAN标识,所述二层转发表项的指令集包括输出端口号;
    所述三层转发表项的匹配域包括至少一个以下匹配项:所述数据包的输入端口号、目的物理地址、目的IP地址和源IP地址,所述三层转发表项的指令集包括输出端口号、减TTL指令和修改物理地址指令。
  14. 如权利要求11-13任一项所述的网络设备,其特征在于,
    所述包发送模块还用于:
    若所述第一匹配表中不存在与所述数据包匹配的表项,则将所述数据包发 送至控制器,以使所述控制器生成转发表项生成指令;
    所述网络设备还包括:
    指令接收模块,用于接收所述控制器发送的所述转发表项生成指令,并根据所述转发表项生成指令在所述第一匹配表中生成转发表项。
  15. 如权利要求11所述的网络设备,其特征在于,所述第一匹配表包括物理地址表,所述二层业务处理模块还用于:
    将所述二层转发表项保存到所述第一匹配表的物理地址表中。
  16. 如权利要求15所述的网络设备,其特征在于,所述网络设备还包括:
    索引号获取模块,用于获取所述二层转发表项在所述第一匹配表的索引号;
    报告消息生成模块,用于生成报告消息;
    报告消息发送模块,用于将所述报告消息发送至控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令,所述转发表项生成指令中包括所述索引号;
    指令接收模块,用于接收所述控制器发送的所述转发表项生成指令,并根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述二层转发表项;
    表项判断模块,用于判断所述二层转发表项和所述转发表项生成指令指示生成的转发表项是否相同;
    所述二层业务处理模块还用于:
    若所述二层转发表项和所述转发表项生成指令指示生成的转发表项不相同,则根据所述转发表项生成指令修改所述二层转发表项。
  17. 如权利要求15所述的网络设备,其特征在于,所述网络设备还包括:
    索引号获取模块,用于获取所述二层转发表项在所述第一匹配表的索引号;
    报告消息生成模块,用于生成报告消息;
    报告消息发送模块,用于将所述报告消息和所述二层转发表项发送给控制器,所述报告消息包括所述索引号和所述数据包,以使所述控制器根据所述数据包生成转发表项生成指令;
    指令接收模块,用于接收所述控制器在判定所述转发表项生成指令指示生成的转发表项与所述二层转发表项不相同时发送的所述转发表项生成指令,所述转发表项生成指令包括所述索引号;
    所述二层业务处理模块还用于:
    根据所述转发表项生成指令中的所述索引号从所述第一匹配表中查找所述二层转发表项,并根据所述转发表项生成指令修改所述第一匹配表中的所述二层转发表项。
  18. 如权利要求11所述的网络设备,其特征在于,所述第二匹配表包括物理地址表,所述网络设备还包括:
    软件学习模块,用于若所述第二匹配表中不存在物理地址与所述目的物理地址匹配的表项,则记录所述数据包的源物理地址、VLAN标识以及输入端口号到所述第二匹配表的物理地址表中。
  19. 如权利要求12所述的网络设备,其特征在于,所述第一匹配表包括路由表和地址解析协议ARP映射表中的至少一种,所述网络设备还包括:
    软件学习模块,用于:
    若所述第二匹配表中不存在与所述目的IP地址匹配的表项,则根据所述数据包的首部信息在所述第二匹配表中创建新的表项,并将创建的所述表项标注为“学习中”;
    通过路由协议对接收的所述数据包进行路由;
    根据路由结果更新创建的所述表项,并且将创建的所述表项的状态标注为“已学习”。
  20. 如权利要求11所述的网络设备,其特征在于,所述网络设备还包括:
    软件学习模块,用于接收所述控制器下发的至少一个表项,并将所述至少 一个表项保存到所述第二匹配表中。
  21. 一种网络设备,其特征在于,所述网络设备的硬件层的自我学习功能关闭且用于维护第一匹配表,所述网络设备的软件层的自我学习功能开启且用于维护第二匹配表,所述网络设备包括网络接口、存储器以及处理器,其中,所述存储器中存储一组程序,且所述处理器用于调用所述存储器中存储的程序,使得所述网络设备执行如权利要求1至10任一所述的方法。
  22. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有程序,所述程序执行时用于使计算机执行包括权利要求1-10中任一项所述的方法。
PCT/CN2015/079071 2015-05-15 2015-05-15 一种数据包转发方法和网络设备 WO2016183732A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
EP15892113.0A EP3288224B1 (en) 2015-05-15 2015-05-15 Data packet forwarding method and network device
PCT/CN2015/079071 WO2016183732A1 (zh) 2015-05-15 2015-05-15 一种数据包转发方法和网络设备
CN201580001163.4A CN107409088B (zh) 2015-05-15 2015-05-15 一种数据包转发方法和网络设备
US15/812,642 US10541914B2 (en) 2015-05-15 2017-11-14 Data packet forwarding method and network device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2015/079071 WO2016183732A1 (zh) 2015-05-15 2015-05-15 一种数据包转发方法和网络设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/812,642 Continuation US10541914B2 (en) 2015-05-15 2017-11-14 Data packet forwarding method and network device

Publications (1)

Publication Number Publication Date
WO2016183732A1 true WO2016183732A1 (zh) 2016-11-24

Family

ID=57319162

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/079071 WO2016183732A1 (zh) 2015-05-15 2015-05-15 一种数据包转发方法和网络设备

Country Status (4)

Country Link
US (1) US10541914B2 (zh)
EP (1) EP3288224B1 (zh)
CN (1) CN107409088B (zh)
WO (1) WO2016183732A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108848034A (zh) * 2018-07-17 2018-11-20 新华三技术有限公司 一种网络设备及表项学习方法

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111464455B (zh) * 2020-03-27 2022-11-25 国家计算机网络与信息安全管理中心 报文输出方法和装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102685006A (zh) * 2012-05-03 2012-09-19 中兴通讯股份有限公司 一种转发数据报文的方法及装置
CN103067534A (zh) * 2012-12-26 2013-04-24 中兴通讯股份有限公司 一种NAT实现***、方法及Openflow交换机
WO2014063605A1 (en) * 2012-10-22 2014-05-01 Huawei Technologies Co., Ltd. System and apparatus of generalized network controller for a software defined network (sdn)
US20140341131A1 (en) * 2013-05-15 2014-11-20 Samsung Electronics Co., Ltd. Method and apparatus for enhancing voice service performance in communication system

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4547341B2 (ja) * 2005-09-05 2010-09-22 アラクサラネットワークス株式会社 通信品質制御機能を備えるパケット中継装置
CN101616159A (zh) * 2009-07-24 2009-12-30 中兴通讯股份有限公司 用于三层交换机的数据转发方法和装置
US8837493B2 (en) 2010-07-06 2014-09-16 Nicira, Inc. Distributed network control apparatus and method
EP2788871B1 (en) * 2011-12-07 2021-08-04 Citrix Systems, Inc. Controlling a network interface using virtual switch proxying
CN103209121B (zh) 2013-03-15 2019-02-01 中兴通讯股份有限公司 基于开放流协议的控制面设备的发现处理方法及装置
US9571386B2 (en) * 2013-07-08 2017-02-14 Nicira, Inc. Hybrid packet processing
CN103401783A (zh) * 2013-07-26 2013-11-20 盛科网络(苏州)有限公司 实现Openflow多级流表的方法及装置
US9270527B2 (en) * 2013-08-05 2016-02-23 The Trustees Of The University Of Pennsylvania Methods, systems, and computer readable media for enabling real-time guarantees in publish-subscribe middleware using dynamically reconfigurable networks
CN103428094B (zh) * 2013-08-12 2016-08-17 杭州华三通信技术有限公司 开放流OpenFlow***中的报文转发方法及装置
CN104426815B (zh) 2013-08-27 2019-07-09 中兴通讯股份有限公司 一种sdn中流表下发的方法和***、of控制器和of交换机
CN108183861B (zh) 2013-10-26 2021-09-07 华为技术有限公司 Sdn交换机获取精确流表项方法及sdn交换机、控制器、***

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102685006A (zh) * 2012-05-03 2012-09-19 中兴通讯股份有限公司 一种转发数据报文的方法及装置
WO2014063605A1 (en) * 2012-10-22 2014-05-01 Huawei Technologies Co., Ltd. System and apparatus of generalized network controller for a software defined network (sdn)
CN103067534A (zh) * 2012-12-26 2013-04-24 中兴通讯股份有限公司 一种NAT实现***、方法及Openflow交换机
US20140341131A1 (en) * 2013-05-15 2014-11-20 Samsung Electronics Co., Ltd. Method and apparatus for enhancing voice service performance in communication system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3288224A4 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108848034A (zh) * 2018-07-17 2018-11-20 新华三技术有限公司 一种网络设备及表项学习方法
CN108848034B (zh) * 2018-07-17 2021-04-27 新华三技术有限公司 一种网络设备及表项学习方法

Also Published As

Publication number Publication date
CN107409088B (zh) 2020-02-14
EP3288224A1 (en) 2018-02-28
EP3288224B1 (en) 2019-11-06
US20180069789A1 (en) 2018-03-08
US10541914B2 (en) 2020-01-21
CN107409088A (zh) 2017-11-28
EP3288224A4 (en) 2018-05-23

Similar Documents

Publication Publication Date Title
US10659342B2 (en) Flow entry configuration method, apparatus, and system
US9264362B2 (en) Proxy address resolution protocol on a controller device
US9602415B2 (en) Flow based network service insertion
EP3490203B1 (en) Method and system for implementing a vxlan control plane
US9374294B1 (en) On-demand learning in overlay networks
JP4834493B2 (ja) ネットワーク中継装置、および、ネットワーク中継装置の制御方法
JP5994846B2 (ja) 通信システム、制御装置、ノード、ノードの制御方法およびプログラム
US9391886B2 (en) Identification of the paths taken through a network of interconnected devices
US9537760B2 (en) Executing loops
CN111464566A (zh) 上下文感知的分布式防火墙
JPWO2014136864A1 (ja) パケット書換装置、制御装置、通信システム、パケット送信方法及びプログラム
JP2020502829A (ja) ネットワークデバイスで使用するためのプログラマブルパケット分類フレームワークを提供するためのシステムおよび方法
US10574570B2 (en) Communication processing method and apparatus
EP3493477B1 (en) Message monitoring
US20210399908A1 (en) Multicast routing
US20160014024A1 (en) Packet forwarding
US20150023358A1 (en) Migration of guest bridge
CN106878106B (zh) 一种可达性检测方法及装置
US11012542B2 (en) Data processing method and apparatus
WO2016183732A1 (zh) 一种数据包转发方法和网络设备
WO2021088439A1 (zh) 一种监控对等体的运行状态的方法、装置及存储介质
US20150381775A1 (en) Communication system, communication method, control apparatus, control apparatus control method, and program
US8855015B2 (en) Techniques for generic pruning in a trill network
WO2016176853A1 (zh) 一种路由查询方法和网络设备
WO2016173196A1 (zh) 地址映射关系的学习方法及装置

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: 15892113

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 2015892113

Country of ref document: EP